Skip to content

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

fix(sql-editor): result table fixes (#2973)

Liu Ji7b3c863995ba
diff --git a/frontend/src/views/sql-editor/TablePanel/DataTable.vue b/frontend/src/views/sql-editor/TablePanel/DataTable.vue
index ef71f592d3..da4d7d1be9 100644
--- a/frontend/src/views/sql-editor/TablePanel/DataTable.vue
+++ b/frontend/src/views/sql-editor/TablePanel/DataTable.vue
@@ -3,15 +3,15 @@
class="bb-data-table relative w-full h-full overflow-hidden flex flex-col"
>
<div class="w-full flex-1 overflow-hidden">
+ <div
+ class="header-track absolute z-0 left-0 top-0 right-0 h-[34px] border border-block-border bg-gray-50"
+ />
+
<div
ref="scrollerRef"
class="inner-wrapper max-h-full w-full overflow-auto border-y border-r border-block-border fix-scrollbar-z-index"
:class="data.length === 0 && 'border-b-0 border-r-0'"
>
- <div
- class="header-track absolute z-0 left-0 top-0 right-0 h-[34px] border border-block-border bg-gray-50"
- />
-
<table
ref="tableRef"
class="relative border-collapse table-fixed z-[1]"
diff --git a/frontend/src/views/sql-editor/TablePanel/useTableResize.ts b/frontend/src/views/sql-editor/TablePanel/useTableResize.ts
index 1ff321d2ea..0c07cea034 100644
--- a/frontend/src/views/sql-editor/TablePanel/useTableResize.ts
+++ b/frontend/src/views/sql-editor/TablePanel/useTableResize.ts
@@ -104,7 +104,13 @@ const useTableResize = (options: TableResizeOptions) => {
const stretchedWidth = getElementWidth(th);
const finalWidth = normalizeWidth(stretchedWidth);
- state.columns[index].width = finalWidth;
+ const column = state.columns[index];
+ if (column) {
+ // Sometimes the `columns` is out-of-sync with the `indexList`
+ // so we need to detect and suppress errors here.
+ // Only occurs in dev hot reload mode.
+ column.width = finalWidth;
+ }
return finalWidth;
});