fix(grid): persist WHERE filter input across tab switches (closes #210)

whereFilterInput was a component-local ref that got lost when switching
tabs because DataGrid is destroyed and recreated via :key binding.

Store whereInput in the QueryTab state and pass it as initialWhereInput
prop so it survives tab switches.
This commit is contained in:
t8y2
2026-05-11 12:24:08 +08:00
parent cb70625bd8
commit 8032c63727
4 changed files with 7 additions and 1 deletions
+2 -1
View File
@@ -80,6 +80,7 @@ const props = defineProps<{
connectionId?: string;
database?: string;
context?: "results" | "table-data";
initialWhereInput?: string;
tableMeta?: {
schema?: string;
tableName: string;
@@ -228,7 +229,7 @@ const orderBySuggestionLeft = ref(0);
const orderByInput = ref("");
const hasOrderByInput = computed(() => orderByInput.value.trim().length > 0);
const whereFilterInput = ref("");
const whereFilterInput = ref(props.initialWhereInput ?? "");
const hasWhereFilterInput = computed(() => whereFilterInput.value.trim().length > 0);
type LocalColumnFilterDraft = {
+1
View File
@@ -374,6 +374,7 @@ function onHandleCloseColumnPanel() {
:loading="activeTab.isExecuting"
:editable="!!activeTab.tableMeta?.primaryKeys?.length"
context="table-data"
:initial-where-input="activeTab.whereInput"
:database-type="activeConnection?.db_type"
:connection-id="activeTab.connectionId"
:database="activeTab.database"