Skip to content

refactor(client): remove redundant location spreads - #47086

Merged
kitlangton merged 2 commits into
v2from
location-spreads
Sep 3, 2026
Merged

kitlangton merged 2 commits into
v2from
location-spreads

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

Why

Six location updates copy the entire cached location record before passing it to Solid's store setter. That setter already shallow-merges the provided record, so these copies repeat work and obscure which field the update owns.

What Changes

Publish only the changed location field, matching the existing locationResource helper:

// Before
setStore("location", key, { ...store.location[key], websearch: providers.data })

// After
setStore("location", key, { websearch: providers.data })

Apply this to connection preload, credential switching, branch updates, shell creation/removal, and websearch refresh. Preserve the nested shell-map and branch spreads: unlike the outer location spreads, those carry fields the replacement value still needs.

Scope

packages/client/src/solid/data.ts: +2 / −9, net −7 production lines. No helper, state, dependency, public interface, or request-scheduling change.

The existing client test file gains 98 lines covering cold shell-event initialization, sibling catalog and shell identity, retained branch metadata, request counts, and sibling preservation during credential events across locations/workspaces. These checks pass against both the original implementation and the deletion, including the focused browser-Solid run.

Verification

With Bun 1.4.0, from the indicated package directories:

# packages/client
bun run test
bun run test --conditions=browser test/solid-data.test.ts -t 'preserves sibling catalogs|refreshes global credential'
bun typecheck
bun run build
bunx prettier --check src/solid/data.ts test/solid-data.test.ts

# packages/tui
bun run test test/cli/tui/data.test.tsx

# packages/app
bun run test
  • Client: 147 passed; the two focused browser-condition checks also passed before and after the production change. Typecheck and package build passed.
  • TUI data suite: 46 passed.
  • App: 717 unit passed, 1 skipped; 113 browser-runtime passed.
  • The normal pre-push hook completed all 33 workspace typecheck tasks.
  • An exploratory whole-file --conditions=browser run before the production change exposed two existing assertions in the assistant-content replacement and user-shell metadata tests. The normal configured client suite passes; those unrelated browser-condition assertions are not changed here.
  • No performance improvement is claimed beyond removing redundant object construction and setter inputs. There is no visible UI change or new fetch policy.

@kitlangton
kitlangton enabled auto-merge (squash) September 3, 2026 16:21
@kitlangton
kitlangton merged commit 610d7e9 into v2 Sep 3, 2026
12 of 13 checks passed
@kitlangton
kitlangton deleted the location-spreads branch September 3, 2026 16:51
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant