mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-29 08:11:06 +00:00
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
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user