fix(data-grid): preserve resized column widths across query reruns
This commit is contained in:
1 parent
ff4667b93f
commit
707296c71d
6 files changed
+78
-5
No files matched your search
@@ -452,6 +452,7 @@ interface DataGridProps {
|
||||
countTotalRows?: () => Promise<number | undefined>;
|
||||
loading?: boolean;
|
||||
cacheKey?: string;
|
||||
columnWidthCacheKey?: string;
|
||||
pendingStateKey?: string;
|
||||
exportSql?: string;
|
||||
onExecuteSql?: (sql: string) => Promise<void>;
|
||||
@@ -2714,7 +2715,7 @@ function scrollToColumnIndex(columnIndex: number) {
|
||||
// --- Column resize composable ---
|
||||
const columnWidthDensity = computed(() => settingsStore.editorSettings.columnWidthDensity);
|
||||
const tableFontFamily = computed(() => settingsStore.editorSettings.tableFontFamily);
|
||||
const columnWidthCacheKey = computed(() => props.cacheKey?.trim() || undefined);
|
||||
const columnWidthCacheKey = computed(() => props.columnWidthCacheKey?.trim() || props.cacheKey?.trim() || undefined);
|
||||
const columnStructureSignature = computed(() => createDataGridColumnStructureSignature(props.result.columns, props.result.column_types));
|
||||
// Bumped once the configured header font is ready, so widths measured against a temporary fallback
|
||||
// font get re-measured without reacting to unrelated fonts loaded elsewhere in the application.
|
||||
|
||||
@@ -125,7 +125,20 @@ import { TABLE_FONT_SIZE_MAX, TABLE_FONT_SIZE_MIN, useSettingsStore, type DataGr
|
||||
import { useToast } from "@/composables/useToast";
|
||||
import { isTauriRuntime } from "@/lib/backend/tauriRuntime";
|
||||
import { canCancelQueryExecution, queryExecutionLabelKey } from "@/lib/sql/queryExecutionState";
|
||||
import { databaseDisplayNameForTab, executionSummaryItems, queryResultExecutionSql, resultGridCacheKey, resultGridInstanceKey, resultRunItems, resultSourceRange, resultSqlForGrid, statementExecutionMarkers, tabularResultItems, type ExecutionSummaryItem } from "@/lib/tabs/tabPresentation";
|
||||
import {
|
||||
databaseDisplayNameForTab,
|
||||
executionSummaryItems,
|
||||
queryResultExecutionSql,
|
||||
resultGridCacheKey,
|
||||
resultGridColumnWidthCacheKey,
|
||||
resultGridInstanceKey,
|
||||
resultRunItems,
|
||||
resultSourceRange,
|
||||
resultSqlForGrid,
|
||||
statementExecutionMarkers,
|
||||
tabularResultItems,
|
||||
type ExecutionSummaryItem,
|
||||
} from "@/lib/tabs/tabPresentation";
|
||||
import { defaultQueryResultArchiveFileName } from "@/lib/query/queryResultArchive";
|
||||
import { saveQueryResultArchiveFile } from "@/lib/query/queryResultArchiveFile";
|
||||
import { isTableDataEditable } from "@/lib/table/tableEditing";
|
||||
@@ -443,6 +456,7 @@ const allResultExportSheets = computed(() =>
|
||||
);
|
||||
const resultRuns = computed(() => resultRunItems(props.activeTab));
|
||||
const activeResultGridCacheKey = computed(() => resultGridCacheKey(props.activeTab));
|
||||
const activeResultGridColumnWidthCacheKey = computed(() => resultGridColumnWidthCacheKey(props.activeTab));
|
||||
const activeResultGridInstanceKey = computed(() => resultGridInstanceKey(props.activeTab));
|
||||
const activeResultSql = computed(() => resultSqlForGrid(props.activeTab));
|
||||
const activeResultExportSql = computed(() => queryResultExecutionSql(props.activeTab));
|
||||
@@ -1716,6 +1730,7 @@ defineExpose({
|
||||
ref="dataGridRef"
|
||||
:key="activeResultGridInstanceKey"
|
||||
:cache-key="activeResultGridCacheKey"
|
||||
:column-width-cache-key="activeResultGridColumnWidthCacheKey"
|
||||
:pending-state-key="activeResultGridInstanceKey"
|
||||
class="flex-1 min-h-0"
|
||||
:result="activeTab.result"
|
||||
|
||||
Reference in new issue
Block a user