mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-31 16:24:33 +00:00
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:
@@ -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 = {
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user