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
fix: tab keeps old server profile when moved to SQLite #962
When the selected connection changes to a SQLite file, the active tab is pointed at it but keeps the profileId of the server it was on before. At the next start useStartupReconnect reconnects that profile and binds the tab back to the old server. #961 fixes the same stale profile for the rebind that happens on Run (#944); this is the other route to it.
Reproduce
Connect to a saved MySQL profile and open a query tab on it.
Open a SQLite file so it becomes the selected connection; the active tab follows it.
Restart the app.
Expected: the tab is not tied to the MySQL profile any more. Actual (from reading the code, not run in the desktop app): the tab still carries the profile, so the profile is reconnected and the tab rebound to it.
src/components/layout/useConnectionSwitching.ts:78 passes conn?.profile_id, which is undefined for a SQLite file because conn is looked up among server connections. setTabConnection (src/stores/editorStore.ts) reads an omitted profileId as "keep the current one". src/components/layout/useStartupReconnect.ts:18-32 then reconnects every tab's profileId.
Fix
After #961, setTabConnection accepts null to clear the profile. Widen requestTabConnection's profileId to string | null and pass conn?.profile_id ?? null at line 78 (check line 43 for the same case). Add a test in src/stores/__tests__/editorStore.test.ts or next to the hook: a tab moved from a server to a SQLite file has no profileId afterwards.
Activity