Commit Graph

6232 Commits

Author SHA1 Message Date
James George
609dfe84e7 fix(common): normalize search tree adapter for team collection shape [skip ci]
The search tree adapter was typed `Ref<HoppCollection[]>` but the teams
provider forces a `Ref<TeamCollection[]>` into it via a double-cast
(`as unknown as Ref<HoppCollection[]>` in teams.workspace.ts:1472).
`HoppCollection` uses `folders` while `TeamCollection` uses `children`.

Root-level rendering worked because both types expose a top-level
`requests`, but expanding a nested team search hit would throw
`TypeError: Cannot read properties of undefined (reading 'map')` on
`item.folders.map`.

Normalize access inside the adapter via a union-safe shape that reads
either `folders` or `children`, and replace the personal-only
`navigateToFolderWithIndexPath` walk with a local walker using the same
accessor. Personal-workspace behavior is unchanged; team-workspace
expansion now walks the nested tree correctly.
2026-04-14 13:47:40 +05:30
James George
e49e0a0013 fix(common): reassign handle .value instead of deep-mutating nested data [skip ci]
WritableComputedRef setter only fires on .value assignment, not on
nested property mutation. Replace .value.data.requestID = ... with
full .value = { ...value, data: { ...data, ... } } to guarantee
reactive propagation through the writable computed layer.
2026-03-20 13:07:08 +05:30
James George
106147be25 fix(common): replace placeholder icons in TeamsWorkspaceSelector [skip ci]
Use IconUsers for team workspace items and IconCheck for the active
workspace indicator, matching the pattern in PersonalWorkspaceSelector.
Remove debug comment.
2026-03-18 12:42:01 +05:30
James George
a65a7c8cee fix(common): add .prevent modifier to dragover in new collection/request components [skip ci]
HTML5 DnD requires dragover to call preventDefault() for the drop
event to fire. Without it, drops can be silently blocked by the
browser.
2026-03-18 12:26:23 +05:30
James George
fae617c44a fix(common): remove trailing hr divider and dead code in workspace Selector [skip ci]
Conditionally render the <hr> separator only between items (not after
the last one). Remove commented-out action handler block.
2026-03-17 13:30:57 +05:30
James George
0a7b825977 fix(common): use graphql_error instead of network_error for null collection response [skip ci]
A null collection from the GQL query is an unexpected server response,
not a network error. Reclassify to graphql_error for accurate error
categorization.
2026-03-17 13:00:38 +05:30
James George
79efff2b38 fix(common): wrap raw i18n key with t(), return loaded state for unresolvable search nodes [skip ci]
- Wrap raw "error.something_went_wrong" string with t() in
  ImportExport.vue environment export action
- Return status: "loaded" with empty data instead of "loading" for
  unresolvable nodes in search tree adapter to avoid perpetual
  loading spinners
2026-03-16 15:01:37 +05:30
James George
3092caa720 fix(common): guard all JSON.parse calls in teams provider with safeJSONParse helper [skip ci]
Extract a safeJSONParse helper that logs and returns a fallback on
failure. Apply it to all remaining unguarded JSON.parse sites:

- Collection data parsing in _getCollectionChildren/_getRootCollections
- Request data parsing in _getCollectionChildRequests (uses flatMap to
  skip unparseable requests instead of pushing null)
- Environment variables in create/duplicate/import (defaults to [])
- Environment variables in update paths (preserves existing variables
  on parse failure instead of wiping to [])
- Environments view computed
- Subscription handlers (replaces earlier manual try/catch blocks)
2026-03-16 14:12:41 +05:30
James George
2e5b5453e2 chore(common): clean up test workspace provider for production readiness
- Remove window.testData global leak
- Replace useTimestamp live 3s polling timer with static ref
- Change implements Partial<WorkspaceProvider> to full interface
  implementation with explicit throw stubs for unimplemented methods
- Remove eager TestWorkspaceProviderService instantiation from index.ts
  so it's tree-shaken out of production builds
2026-03-16 13:06:45 +05:30
James George
0f8ad413f7 fix(common): guard subscription JSON.parse and clear stale state on workspace switch
- Wrap JSON.parse in subscription handlers (request added/updated,
  environment created/updated) with try/catch — a malformed server
  payload would crash the handler and kill the entire subscription
  stream for the session
- Clear collections and requests arrays before setting up new
  subscriptions in selectWorkspace to prevent race conditions where
  subscription events push into stale previous-workspace state during
  the initial fetch await
2026-03-13 20:01:48 +05:30
James George
da3feaf209 fix(common): return empty result instead of throwing in tree adapter
getChildren threw an unhandled exception when the workspace handle was
invalid — the tree component doesn't wrap calls in try/catch, so this
propagated into Vue's render cycle. Return an empty loaded result
instead, matching the error recovery pattern used elsewhere in the
adapter.
2026-03-13 19:50:24 +05:30
James George
f4b0c3cd5e fix(common): clear subscriptions array and fix import success detection
- Reset this.subscriptions to [] after unsubscribing in selectWorkspace
  to prevent unbounded array growth on workspace switches
- Narrow importRESTEnvironments filter to check E.isRight in addition
  to promise fulfillment — prevents false success when all GQL calls
  return E.Left
2026-03-13 19:39:22 +05:30
James George
74b9acfd8d fix(common): capture handle data before async gaps in teams provider
getRESTCollectionChildrenView accessed collectionHandleRef.value.data
after await boundaries — the computed ref re-evaluates on each access
and could return { type: "invalid" } if a subscription deleted the
collection during the in-flight API request, causing a TypeError on
.data access. Capture collectionID and workspaceID before the async
gap and use the stable values in .then() callbacks.
2026-03-13 19:31:02 +05:30
James George
32713873f0 fix(common): fix type narrowing and ref mutation in teams workspace
- Add type predicate to PromiseSettledResult filter in
  importRESTEnvironments so TypeScript narrows to
  PromiseFulfilledResult (fixes .value access on union type)
- Replace ref mutation inside computed in getRESTEnvironmentsView
  with a separate computed ref — avoids Vue readonly warning and
  potential infinite update loops
2026-03-13 19:11:34 +05:30
James George
13b3e5dc80 fix(common): remove dead computed writes in personal workspace provider
Handle refs from getRESTCollectionHandle/getRESTEnvironmentHandle are
lazy-computed — writing to .value is a no-op that triggers Vue readonly
warnings. The computed already auto-invalidates when the backing store
changes, so manual invalidation and name synchronization blocks are
unnecessary. Removes dead code in:
- updateRESTCollection (post-rename handle mutation)
- removeRESTCollection (post-delete handle invalidation)
- updateRESTEnvironment (post-rename handle mutation)
- removeRESTEnvironment (post-delete handle invalidation)
2026-03-13 19:03:00 +05:30
James George
0c6a8b31cd fix(common): use platform.kernelIO and add missing imports in TeamListAdapter
- platform.io doesn't exist on PlatformDef — all other callsites use
  platform.kernelIO.saveFileWithDialog
- fetchAllTeams referenced runGQLQuery and GetMyTeamsDocument without
  importing them, causing a build failure
2026-03-13 18:44:44 +05:30
James George
c3243f5ac8 fix(collections): add missing type discriminant to createNewTab, fix HoppRESTDocument imports
- Add type: "request" to both createNewTab calls in new-collections/rest
  component — required by HoppTabDocument discriminated union
- Replace non-existent HoppRESTDocument with correct types:
  HoppRequestDocument in Request.vue, HoppTabDocument in helpers/tab,
  remove duplicate broken import in TabHead.vue
2026-03-13 18:11:01 +05:30
James George
771e4c628d fix(teams-workspace): sort root-level collections in makeCollectionTree output 2026-03-13 17:53:55 +05:30
James George
f20d04338c fix(tabs): restore tabs even when handle resolution fails, avoid mutating updatedRequest
- Tab restoration now always preserves the tab with its request data;
  handle rehydration is best-effort — failed resolution no longer drops
  the entire tab
- Replace delete updatedRequest.id with destructuring to avoid mutating
  the caller's parameter object
2026-03-13 17:45:13 +05:30
James George
8cab15cc84 fix(tabs): await async loadTabsFromPersistedState, replace lodash merge with spread
- loadTabsFromPersistedState became async but callers were not updated,
  causing a race where the persistence watcher could overwrite tabs with
  an empty/partial array before handle resolution completes
- Replace lodash merge() with shallow spread in personal updateRESTRequest
  to avoid element-by-element array merging that preserves deleted entries
2026-03-13 17:38:52 +05:30
James George
6ac686ad4a fix(teams-workspace): fix makeCollectionTree leaf request loss, stale env ref, and dirty-check semantics
- makeCollectionTree: always add each collection's own ID to the parent
  set so requests on leaf collections are not silently dropped during export
- getRESTEnvironmentsView: create the environments ref once outside the
  computed and update .value inside, preventing stale ref on re-evaluation
- RequestTab.vue: restore isEqualHoppRESTRequest from @hoppscotch/data
  instead of lodash isEqual to preserve empty-entry filtering semantics
2026-03-13 15:14:15 +05:30
James George
213adfe918 fix(teams-workspace): cascade-remove descendant collections on delete, default isDirty on invalid handle
- removeRESTCollection and the collection-removed subscription now walk
  the parent chain to remove all descendant collections and their
  requests from local state (backend cascade-deletes but subscription
  only fires for the top-level ID)
- RequestTab.vue sets isDirty=true when the request handle is absent
  or invalid, preventing silent loss of edits
2026-03-13 15:03:38 +05:30
James George
323c67c590 fix(adapters): log errors in tree adapter catch blocks instead of silently swallowing 2026-03-13 14:59:14 +05:30
James George
54f00af5db fix(teams-workspace): normalize parentCollectionID and sort siblings before order generation
- parent?.id returns undefined for root collections; normalize to null
  so sibling filter matches correctly
- sort filtered siblings with sortByOrder() before .at(-1) to ensure
  generated fractional index follows the actual last sibling's order
2026-03-13 14:56:06 +05:30
James George
451c5c63f0 fix(common): fix reorderItems -1 guard, moveRESTCollection prefix match, reactive collection handle 2026-03-13 14:44:03 +05:30
James George
323bd8b7ad fix(common): fix reorder path construction, moveRequest exact-match, reactive env handle, clear stale requests 2026-03-13 14:38:16 +05:30
James George
b99ed62bc8 fix(common): guard against null collection and out-of-bounds environment access in personal provider 2026-03-13 14:36:08 +05:30
James George
8b0ed65646 fix(common): fix isLastItem for single-item collections, deduplicate type guards in teams provider 2026-03-13 14:29:44 +05:30
James George
82c9d03e89 fix(common): merge request before sending to backend, add missing lazy() and isFetchingRequests flag 2026-03-13 13:52:15 +05:30
James George
243b0ec8ff fix(common): align updateRESTRequest signature with interface, fix name fallback and GQLError<any> 2026-03-13 13:45:35 +05:30
James George
9ebe243856 fix(common): wrap tree adapter async IIFEs in try-catch to prevent stuck loading state 2026-03-13 13:33:07 +05:30
James George
2dd22db18e fix(common): align createRESTRootCollection signature with interface in teams provider 2026-03-13 13:28:12 +05:30
James George
617c009714 fix(common): change remaining Exclude<HoppCollection> to Omit in provider implementations [skip ci] 2026-03-13 13:23:30 +05:30
James George
1256ca5403 fix(common): fix root-level moveRESTCollection, duplicateRESTEnvironment, partial env update wipe, computed leaks, tree adapter rejections, Exclude→Omit [skip ci] 2026-03-13 13:20:13 +05:30
James George
bad1f44a49 fix(common): guard cross-collection handle contamination, propagate full request on update, fix handle type in createRESTChildCollection [skip ci] 2026-03-11 19:42:53 +05:30
James George
73454d0b59 fix(common): remove non-null assertion in lazy(), fix getRequestsByPath return type [skip ci] 2026-03-11 16:44:00 +05:30
James George
63070c369f fix(common): return to continue in tab loops, guard cursor update in _getRootCollections [skip ci] 2026-03-11 16:20:39 +05:30
James George
4c82d9ffc0 fix(common): rename teamListadapter to teamListAdapter for consistency [skip ci] 2026-03-11 15:53:49 +05:30
James George
b2c082ed1d fix(common): add explicit radix to remaining parseInt calls in request.ts [skip ci] 2026-03-11 15:17:30 +05:30
James George
6f7f9dda7d fix(common): use dropItemID.value instead of replacing ref on dragend [skip ci] 2026-03-11 13:08:26 +05:30
James George
79c892e5e2 fix(common): add missing click handler on empty-state button, add parseInt radix [skip ci] 2026-03-11 12:49:23 +05:30
James George
7b8b8b1cf9 fix(common): import from @hoppscotch/ui public entrypoint [skip ci] 2026-03-11 12:04:49 +05:30
James George
d6aebbc8c6 fix(common): use teamsService.providerID instead of string literal [skip ci] 2026-03-11 11:46:50 +05:30
James George
2f3d04cee1 fix(common): set dragging to true on dragstart instead of toggling [skip ci] 2026-03-11 11:41:48 +05:30
James George
25d1c17743 fix(common): wrap catch errors in GQLError shape, fix raw toast message [skip ci]
Wrap unknown exceptions in generator catch blocks into proper
GQLError<string> objects with network_error type. Replace raw
error string in environment deletion toast with translated message.
2026-03-11 11:26:52 +05:30
James George
88478e23e0 fix(common): align GQLError shape with type definition [skip ci] 2026-03-11 11:21:30 +05:30
James George
a575ca2b80 fix(common): add null guard for collection, fix raw i18n key in toast [skip ci]
Guard against null collection in pagination generator instead of
using non-null assertion. Wrap raw i18n key with t() in collections
ImportExport toast.
2026-03-11 11:06:05 +05:30
James George
ef87cbb75f fix(common): fix pagination infinite loops and remove unused imports [skip ci]
Break out of pagination generators on Left results in
_getCollectionChildRequests and _getRootCollections to prevent
infinite retry loops. Remove unused imports and variables from
TeamsWorkspaceSelector.
2026-03-11 10:54:56 +05:30
James George
d1e25a562a fix(common): fix grammar in save-request comment 2026-03-11 10:48:52 +05:30
James George
7a747d5c35 fix(common): fix exportAsJSON result treated as boolean instead of Either
[skip ci]
2026-03-10 15:32:29 +05:30