From c37caeba78f1a40707ff3b02f82f2d45ba997291 Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Thu, 14 May 2026 19:19:21 +0800 Subject: [PATCH] fix: apply only visible checked values when local filter has active search When a user searches in the column filter dialog, non-visible options retained their selected state, making it impossible to filter to just the searched values. Now when a search query is active, only visible checked items are included in the applied filter. --- src-tauri/src/lib.rs | 1 + src/components/grid/DataGrid.vue | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index fb7d141b2..d8c45c82f 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -5,6 +5,7 @@ mod models; use commands::connection::AppState; use dbx_core::storage::Storage; use std::sync::Arc; +use std::time::Instant; use tauri::{Manager, RunEvent}; #[cfg_attr(mobile, tauri::mobile_entry_point)] diff --git a/src/components/grid/DataGrid.vue b/src/components/grid/DataGrid.vue index 1693e443d..f14e45b44 100644 --- a/src/components/grid/DataGrid.vue +++ b/src/components/grid/DataGrid.vue @@ -391,10 +391,15 @@ function applyLocalFilter() { if (!draft) return; const allKeys = new Set(localFilterAllOptions.value.map((option) => option.key)); const next = { ...localColumnFilters.value }; - if (draft.values.size === 0 || draft.values.size === allKeys.size) { + let selected = draft.values; + if (localFilterSearch.value.trim()) { + const visibleKeys = new Set(localFilterOptions.value.map((o) => o.key)); + selected = new Set([...draft.values].filter((k) => visibleKeys.has(k))); + } + if (selected.size === 0 || selected.size === allKeys.size) { delete next[draft.columnIndex]; } else { - next[draft.columnIndex] = new Set(draft.values); + next[draft.columnIndex] = new Set(selected); } localColumnFilters.value = next; closeLocalFilter();