You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor: one definition of the live connection list #963
"Every connection that can run a statement right now" (connected servers plus open SQLite files) is built in four places. They agree today, but where a run goes and whether a tab counts as orphaned (#944) both depend on them agreeing, so a change to one that misses the others would bring back bugs of that kind.
The fourth is liveConnectionIds() in src/lib/run-connection.ts, shared by the stores and useConnectionSwitching since #961.
Cause
The three hook and component copies are built from store selectors so they re-render when connections change; liveConnectionIds() reads store state once and can't replace them directly.
Fix
Add a useLiveConnectionIds hook next to liveConnectionIds() that subscribes to both stores and returns the same list, and use it in the three files. No behaviour change; the existing tests for those hooks and SQLEditor should pass unchanged.
While there: src/components/layout/useStartupReconnect.ts:20 uses a ! non-null assertion (t.profileId!), which src/CLAUDE.md rules out. Narrow with a type guard in the filter instead.
Activity