Fix database UI query issues - #613
Conversation
23b4526 to
ba58c90
Compare
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (5 files)
Reviewed by step-3.7-flash · Input: 84.7K · Output: 23.1K · Cached: 2.2M |
debba
left a comment
There was a problem hiding this comment.
Hey @DhruvShah-Dev, thanks for this one! I did a deep local review: ran your tests on the branch and spun up real MariaDB 11 and MySQL 8.4 containers to verify the JSON fix. Here's where I landed.
The good news: the MariaDB JSON fix is solid. Verified against real databases:
- the old shape
SET col = CAST('{"ok":true}' AS JSON)fails on MariaDB 11 with error 1064, which is exactly the bug in #610 - the new plain-string shape works on MariaDB for both TEXT and JSON columns, and on MySQL 8.4 the value stays typed JSON (
JSON_TYPE= OBJECT) - MySQL still rejects invalid JSON server-side (error 3140), so dropping the CAST doesn't lose any validation
Both new Rust tests pass on your branch, and extracting push_mysql_update_value matches the existing push_pk_condition pattern in mod.rs. This part is merge-ready as far as I'm concerned.
The problem: the branch is now conflicting with main. The command palette refactors merged on Aug 10 (778b5cc, ff51644) deleted QuickNavigatorModal.tsx entirely. The bug you're fixing in #591 is still real on current main, but it now lives in src/hooks/useCommandPaletteObjectItems.ts (around line 95), which still derives configuredDatabases from getDatabaseList(connection?.params.database) instead of the live selection. So that part needs to be reimplemented in the new hook rather than mechanically rebased. Heads up: the hook is per-connection via connectionDataMap, while selectedDatabases in DatabaseProvider tracks the active connection only, so it's not a one-to-one port.
About #608: the issue is about the error text in the query result panel, which is rendered by src/components/ui/ErrorDisplay.tsx. That component is untouched here and is still unselectable (we have a global user-select: none in index.css). ErrorModal.tsx is actually dead code right now: its only mount in Editor.tsx has an isOpen state that nothing ever sets to true, on your branch as well as on main. Also note we already shipped copy + selectable text in AlertModal via #618. So the right home for the #608 fix is ErrorDisplay.tsx.
Minor nit: the copy button uses dataGrid.copied, but since #618 we have common.copied in every locale, better to use that one for consistency.
My suggestion: split this PR in three.
- The Rust JSON fix + tests as a standalone PR, that one can go in quickly.
- The #591 fix reimplemented in
useCommandPaletteObjectItems.tson top of current main. - The #608 fix moved to
ErrorDisplay.tsx(andErrorModal.tsxcould probably just be deleted as dead code while you're at it).
Thanks again for digging into these!
Summary
Closes #591.
Closes #608.
Closes #610.
Validation