From e1a07aae4abd6c8badb2ae2746e367ba2e6f54a5 Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Tue, 12 May 2026 23:05:29 +0800 Subject: [PATCH] fix(grid): sync WHERE filter input to tab store on every keystroke The previous fix (8032c63) only persisted whereInput when the user triggered reload/paginate/sort. Typing a condition and switching tabs without executing still lost it because the local ref was destroyed on component unmount. Emit update:whereInput on every change so ContentArea writes the value to activeTab.whereInput immediately. Fixes #232 --- src/components/grid/DataGrid.vue | 2 ++ src/components/layout/ContentArea.vue | 1 + 2 files changed, 3 insertions(+) diff --git a/src/components/grid/DataGrid.vue b/src/components/grid/DataGrid.vue index 12c5a7e1a..8de26282f 100644 --- a/src/components/grid/DataGrid.vue +++ b/src/components/grid/DataGrid.vue @@ -112,6 +112,7 @@ const emit = defineEmits<{ reload: [sql?: string, searchText?: string, whereInput?: string, orderBy?: string, limit?: number, offset?: number]; paginate: [offset: number, limit: number, whereInput?: string, orderBy?: string]; sort: [column: string, columnIndex: number, direction: "asc" | "desc" | null, whereInput?: string]; + "update:whereInput": [value: string]; }>(); const hasData = computed(() => props.result.columns.length > 0); @@ -564,6 +565,7 @@ function navigateWhereSuggestion(delta: number) { } watch(whereFilterInput, (val) => { + emit("update:whereInput", val); whereSuggestions.value = []; if (!props.tableMeta?.columns?.length) return; const trimmed = val.trim(); diff --git a/src/components/layout/ContentArea.vue b/src/components/layout/ContentArea.vue index aac3ee480..ecfbaff79 100644 --- a/src/components/layout/ContentArea.vue +++ b/src/components/layout/ContentArea.vue @@ -386,6 +386,7 @@ function onHandleCloseColumnPanel() { :database="activeTab.database" :table-meta="activeTab.tableMeta" :on-execute-sql="async (sql: string) => emit('executeSql', sql)" + @update:where-input="(v: string) => (activeTab.whereInput = v)" @reload=" ( sql?: string,