Repository navigation
refactor: share one live connection list - #965
Merged
Merged
Conversation
Run, the results panel and the editor each rebuilt the list of connected servers and open SQLite files. They now read it from useLiveConnectionIds or liveConnectionIds, so the lists cannot drift. Also narrows a non-null assertion in useStartupReconnect. Closes #963 Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_014tzYxya6Umczq4EBPTYkX4
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
"Every connection that can run a statement right now" (connected servers plus open SQLite files) was built in four places. Where a run goes and whether a tab counts as orphaned (#944) both depend on those lists agreeing, so a change to one that missed the others would bring that class of bug back.
Change
useLiveConnectionIdshook (src/hooks/): the reactive form ofliveConnectionIds()fromsrc/lib/run-connection.ts. It subscribes to both stores and returns the same list.useQueryExecutionanduseResultsFollowActiveTabuse the hook instead of building the list inline.SQLEditor'sactiveTabContext()reads store state at call time, so it usesliveConnectionIds()directly.useStartupReconnectcollects profile ids withflatMapinstead of a!non-null assertion, whichsrc/CLAUDE.mdrules out.No behaviour change.
Tests
src/hooks/__tests__/useLiveConnectionIds.test.ts: lists servers and files, follows them as they come and go, and equalsliveConnectionIds().Gates run locally: dprint,
npm run lint(0 errors),npm run type-check,npm run test:unitvia the pre-commit hooks, andSQLEditor.browser.test.tsx(18 tests). The rest of the browser suite was not run.Closes #963
Generated by Claude Code