Fix quick navigator database selection - #597
Conversation
debba
left a comment
There was a problem hiding this comment.
Hey @DhruvShah-Dev, I reviewed this one locally too. The fix itself is exactly right, and honestly this is the better of your two takes on #591: you memoized isMultiDb and used it consistently in the click handlers as well, so table refs get quoted the same way the rest of the app decides multi-db layout. All 9 tests pass on your branch, including the new regression test for stale database data, which is a nice touch.
The problem is timing: the command palette refactor merged on Aug 10 (778b5cc, ff51644) deleted QuickNavigatorModal.tsx entirely, so this branch is now conflicting and the main file it patches no longer exists.
The good news is that the bug is still alive on current main and your fix ports over cleanly:
- The logic moved to
src/hooks/useCommandPaletteObjectItems.ts, which still doesgetDatabaseList(connection?.params.database)(around line 95). On current main,ConnectionDatain the provider already carriesselectedDatabasesper connection, so you can readconnectionData?.selectedDatabasesright there. It's actually a nicer fit than the old modal, because the hook is per-connection. - While you're at it,
isMultiDatabaseCapable(connectionData?.capabilities)in that hook should becomeusesMultiDatabaseLayout(capabilities, selectedDatabases)to match the sidebar and the editor. - Your
quickNavigator.tsparam rename (configuredDatabasestoselectedDatabases) and the regression test still apply almost as-is. The util was reshaped into a groups/flatMap structure on main, but the semantics are unchanged, so it's just a mechanical adjustment.
One more thing: #613 includes a subset of this same fix, so both PRs claim #591. I'd consolidate on this one since it's the more complete version, and drop the navigator changes from #613 (see my review over there).
So: rework on top of current main targeting useCommandPaletteObjectItems.ts, keep the test, and this should go in quickly. Thanks for the patience with the moving target, the palette refactor landed right under your feet.
debba
left a comment
There was a problem hiding this comment.
Thanks for porting the fix to the command palette flow. The implementation now uses the live per-connection selected database list, aligns multi-database detection with the rest of the app, and includes regression coverage ensuring stale cached database data is ignored. Verified locally: 7/7 targeted tests pass, typecheck passes, and lint passes. Looks good to merge.
Summary
Testing
Fixes #591