Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: sql editor issues (#20293)

ecmadao9c635cac6ded
diff --git a/frontend/src/react/components/DataExportButton.tsx b/frontend/src/react/components/DataExportButton.tsx
index 4bd46cda9b..8481200412 100644
--- a/frontend/src/react/components/DataExportButton.tsx
+++ b/frontend/src/react/components/DataExportButton.tsx
@@ -7,6 +7,7 @@ import {
useCallback,
useEffect,
useMemo,
+ useRef,
useState,
} from "react";
import { useTranslation } from "react-i18next";
@@ -198,12 +199,21 @@ export function DataExportButton({
setPassword("");
}, [defaultLimit, supportFormats]);
- // Reset form whenever the drawer opens, mirroring the Vue watcher.
+ // Reset form whenever the drawer transitions to OPEN. Depending on
+ // `resetForm` here would re-fire the reset on every parent re-render
+ // because `supportFormats` typically arrives as a fresh inline array
+ // (e.g. `supportFormats={[CSV, JSON, SQL, XLSX]}` from
+ // `SingleResultView`), which churns `resetForm`'s identity and would
+ // clobber the user's just-changed `limit` / `format` / `password`.
+ // Drive the reset off `showDrawer` alone via a ref to the latest
+ // `resetForm`.
+ const resetFormRef = useRef(resetForm);
+ resetFormRef.current = resetForm;
useEffect(() => {
if (showDrawer) {
- resetForm();
+ resetFormRef.current();
}
- }, [showDrawer, resetForm]);
+ }, [showDrawer]);
// Clear password each time the password dialog opens.
useEffect(() => {
diff --git a/frontend/src/react/components/sql-editor/AsidePanel/ActionBarTabItem.tsx b/frontend/src/react/components/sql-editor/AsidePanel/ActionBarTabItem.tsx
index f387c1bead..5c919bb375 100644
--- a/frontend/src/react/components/sql-editor/AsidePanel/ActionBarTabItem.tsx
+++ b/frontend/src/react/components/sql-editor/AsidePanel/ActionBarTabItem.tsx
@@ -58,9 +58,20 @@ export function ActionBarTabItem({ action, disabled }: Props) {
active && "bg-accent/10 text-accent hover:bg-accent/15"
)}
>
+ {/*
+ Several schema icons (`FunctionIcon`, `ProcedureIcon`,
+ `ViewIcon`, `SequenceIcon`, `PackageIcon`) hardcode `text-gray-400`
+ / `text-gray-500` on themselves — and in `ViewIcon`'s case on a
+ nested `<Table>` — to look de-emphasized inside the schema tree.
+ In the ActionBar rail those same icons read as a navigation
+ control, not as disabled. The `[&_*]:!text-current` selector
+ forces every descendant element to inherit this span's color
+ (`text-main` when inactive, the button's `text-accent` when
+ active), beating the icons' hardcoded gray.
+ */}
<span
className={cn(
- "size-4 inline-flex items-center justify-center",
+ "size-4 inline-flex items-center justify-center [&_*]:!text-current",
!active && "text-main"
)}
>
diff --git a/frontend/src/react/components/sql-editor/Panels/Panels.tsx b/frontend/src/react/components/sql-editor/Panels/Panels.tsx
index fc77791dfd..e02130a84c 100644
--- a/frontend/src/react/components/sql-editor/Panels/Panels.tsx
+++ b/frontend/src/react/components/sql-editor/Panels/Panels.tsx
@@ -196,7 +196,20 @@ export function Panels() {
<div className="h-full flex flex-col">
<div className="py-2 px-2 w-full flex flex-row gap-x-2 justify-between items-center">
<div className="flex items-center justify-start gap-2">
- <DatabaseChooser disabled />
+ {/*
+ Wrap the chooser so it's the lone child of its own
+ flex container. The chooser uses
+ `[&:not(:last-child)]:border-r-0` /
+ `first:rounded-l-xs last:rounded-r-xs` to share borders
+ with adjacent buttons in a button-group context. Here
+ the next sibling is a separate Select primitive (not
+ part of the group), so without this wrapper the chooser
+ loses its right border and only gets left-rounded
+ corners.
+ */}
+ <div className="inline-flex">
+ <DatabaseChooser disabled />
+ </div>
<SchemaSelectToolbar />
</div>
</div>
diff --git a/frontend/src/react/components/sql-editor/Panels/common/SchemaSelectToolbar.tsx b/frontend/src/react/components/sql-editor/Panels/common/SchemaSelectToolbar.tsx
index e9cc92bb17..cb56d391d8 100644
--- a/frontend/src/react/components/sql-editor/Panels/common/SchemaSelectToolbar.tsx
+++ b/frontend/src/react/components/sql-editor/Panels/common/SchemaSelectToolbar.tsx
@@ -49,7 +49,9 @@ export function SchemaSelectToolbar() {
if (typeof value === "string") setSchema(value);
}}
>
- <SelectTrigger size="sm" className="min-w-32">
+ {/* Use `h-8` to align with the sibling `DatabaseChooser` (also h-8);
+ the default `size="sm"` trigger is `h-7` and looked shorter. */}
+ <SelectTrigger size="sm" className="min-w-32 h-8 shrink-0">
<SelectValue />
</SelectTrigger>
<SelectContent>
diff --git a/frontend/src/react/components/sql-editor/ResultView/VirtualDataTable.tsx b/frontend/src/react/components/sql-editor/ResultView/VirtualDataTable.tsx
index f1d3cab5e5..bf48e583e1 100644
--- a/frontend/src/react/components/sql-editor/ResultView/VirtualDataTable.tsx
+++ b/frontend/src/react/components/sql-editor/ResultView/VirtualDataTable.tsx
@@ -266,11 +266,11 @@ export const VirtualDataTable = forwardRef<
return (
<div
ref={containerRef}
- className="relative w-full flex-1 min-h-0 overflow-auto rounded-sm border"
+ className="relative w-full flex-1 min-h-0 overflow-auto rounded-sm border dark:border-zinc-500"
>
{/* Header */}
<div
- className="sticky top-0 z-1 bg-control-bg flex shadow-sm"
+ className="sticky top-0 z-1 bg-control-bg dark:bg-gray-700 flex shadow-sm"
style={{ minWidth: minRowWidth }}
>
{/* Index header */}
@@ -306,10 +306,10 @@ export const VirtualDataTable = forwardRef<
}
onClick={(e) => handleSelectColumn(e, columnIndex)}
className={cn(
- "px-3 py-1.5 min-w-8 text-left text-xs font-medium text-control-light tracking-wider",
+ "px-3 py-1.5 min-w-8 text-left text-xs font-medium text-control-light dark:text-gray-300 tracking-wider",
!selectionDisabled &&
- "cursor-pointer hover:bg-control-bg-hover",
- isSelected && "bg-accent/10!"
+ "cursor-pointer hover:bg-control-bg-hover dark:hover:bg-gray-800",
+ isSelected && "bg-accent/10! dark:bg-accent/40!"
)}
>
<div className="flex items-center min-w-0 gap-x-1">
@@ -392,9 +392,9 @@ export const VirtualDataTable = forwardRef<
{/* Index cell */}
<div
className={cn(
- "relative flex items-center shrink-0 text-sm leading-5 whitespace-nowrap break-all border-block-border border-r border-b group-even:bg-control-bg/40",
- isActive && "bg-accent/10!",
- rowSelected && "bg-accent/20!"
+ "relative flex items-center shrink-0 text-sm dark:text-gray-100 leading-5 whitespace-nowrap break-all border-block-border dark:border-zinc-500 border-r border-b group-even:bg-control-bg/40 dark:group-even:bg-gray-700/50",
+ isActive && "bg-accent/10! dark:bg-accent/40!",
+ rowSelected && "bg-accent/20! dark:bg-accent/40!"
)}
data-col-index={0}
style={{
@@ -416,8 +416,8 @@ export const VirtualDataTable = forwardRef<
aria-label={`Select row ${rowIndex + 1}`}
onClick={(e) => handleSelectRow(e, rowIndex)}
className={cn(
- "absolute inset-y-0 left-0 w-3 cursor-pointer bg-accent/5 hover:bg-accent/10",
- rowSelected && "bg-accent/20!"
+ "absolute inset-y-0 left-0 w-3 cursor-pointer bg-accent/5 hover:bg-accent/10 dark:bg-white/10 dark:hover:bg-accent/40",
+ rowSelected && "bg-accent/20! dark:bg-accent/40!"
)}
/>
)}
@@ -431,12 +431,12 @@ export const VirtualDataTable = forwardRef<
<div
key={`${rowIndex}-${columnIndex + 1}`}
className={cn(
- "relative shrink-0 text-sm leading-5 whitespace-nowrap break-all border-block-border border-b group-even:bg-control-bg/40",
+ "relative shrink-0 text-sm dark:text-gray-100 leading-5 whitespace-nowrap break-all border-block-border dark:border-zinc-500 border-b group-even:bg-control-bg/40 dark:group-even:bg-gray-700/50",
!isLastCol && "border-r",
// Match the Vue version: an active (search-matched) row
// highlights every cell in that row, not just the index
// column.
- isActive && "bg-accent/10!"
+ isActive && "bg-accent/10! dark:bg-accent/40!"
)}
data-col-index={columnIndex + 1}
style={{
@@ -490,7 +490,7 @@ function HeaderCell({
<div
onClick={onClick}
className={cn(
- "group relative shrink-0 border-block-border",
+ "group relative shrink-0 border-block-border dark:border-zinc-500",
borderRight ? "border-x" : "border-l",
className
)}
diff --git a/frontend/src/react/components/sql-editor/TabList.tsx b/frontend/src/react/components/sql-editor/TabList.tsx
index 4986f6a04c..31c5b5b8cd 100644
--- a/frontend/src/react/components/sql-editor/TabList.tsx
+++ b/frontend/src/react/components/sql-editor/TabList.tsx
@@ -260,7 +260,7 @@ export function TabList() {
ref={scrollRef}
onScroll={recalculateScrollState}
className={cn(
- "flex-1 overflow-x-auto scrollbar-thin",
+ "flex-1 overflow-x-auto overflow-y-hidden scrollbar-thin",
scrollState.moreLeft && "more-left",
scrollState.moreRight && "more-right"
)}
@@ -274,7 +274,7 @@ export function TabList() {
items={tabs.map((tab) => tab.id)}
strategy={horizontalListSortingStrategy}
>
- <div className="relative flex flex-nowrap overflow-hidden h-9 pt-0.5">
+ <div className="relative flex flex-nowrap h-9 pt-0.5">
{tabs.map((tab, index) => (
<TabItem
key={tab.id}
diff --git a/frontend/src/react/components/ui/combobox.tsx b/frontend/src/react/components/ui/combobox.tsx
index 6a46e8d681..03eac9262a 100644
--- a/frontend/src/react/components/ui/combobox.tsx
+++ b/frontend/src/react/components/ui/combobox.tsx
@@ -295,7 +295,12 @@ export function Combobox(props: ComboboxProps) {
return (
<span
className={cn(
- "truncate",
+ // `min-w-0` ensures the span can shrink below its content
+ // width in the flex trigger row so `truncate` actually
+ // applies. Without it, flex's default `min-width: auto`
+ // sizes the span to the longest unbreakable text run and the
+ // X/chevron get pushed onto a new line in narrow sidebars.
+ "truncate min-w-0",
!singleSelected && "text-control-placeholder"
)}
>
@@ -414,7 +419,13 @@ export function Combobox(props: ComboboxProps) {
{/* Trigger */}
<div
className={cn(
- "flex flex-wrap items-center gap-1 min-h-9 w-full rounded-xs border border-control-border bg-background px-3 py-1 text-sm leading-5 cursor-pointer",
+ // `flex-wrap` only matters for multi-select where chips can spill
+ // onto a new line; in single-select mode it lets the X/chevron
+ // wrap below a too-narrow label on a narrow container, which
+ // looks broken. Keep the trigger on a single line in that case
+ // and let the label truncate inside `renderTrigger`.
+ "flex items-center gap-1 min-h-9 w-full rounded-xs border border-control-border bg-background px-3 py-1 text-sm leading-5 cursor-pointer",
+ multiple && "flex-wrap",
disabled && "opacity-50 cursor-not-allowed",
open && "border-accent"
)}