Skip to content

refactor: share one live connection list - #965

Merged
EVWorth merged 1 commit into
devfrom
claude/relaxed-edison-8gs7dq
Nov 11, 2026
Merged

EVWorth merged 1 commit into
devfrom
claude/relaxed-edison-8gs7dq

Conversation

@EVWorth

@EVWorth EVWorth commented Nov 11, 2026

Copy link
Copy Markdown
Owner

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

  • New useLiveConnectionIds hook (src/hooks/): the reactive form of liveConnectionIds() from src/lib/run-connection.ts. It subscribes to both stores and returns the same list.
  • useQueryExecution and useResultsFollowActiveTab use the hook instead of building the list inline.
  • SQLEditor's activeTabContext() reads store state at call time, so it uses liveConnectionIds() directly.
  • useStartupReconnect collects profile ids with flatMap instead of a ! non-null assertion, which src/CLAUDE.md rules out.

No behaviour change.

Tests

src/hooks/__tests__/useLiveConnectionIds.test.ts: lists servers and files, follows them as they come and go, and equals liveConnectionIds().

Gates run locally: dprint, npm run lint (0 errors), npm run type-check, npm run test:unit via the pre-commit hooks, and SQLEditor.browser.test.tsx (18 tests). The rest of the browser suite was not run.

Closes #963


Generated by Claude Code

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
@EVWorth
EVWorth merged commit 58f3f04 into dev Nov 11, 2026
15 checks passed
@EVWorth
EVWorth deleted the claude/relaxed-edison-8gs7dq branch November 11, 2026 01:00
@github-actions github-actions Bot mentioned this pull request Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: one definition of the live connection list

2 participants