25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(grid): keep filter editor open after apply
t8y28b3843dfd8fb
diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vueindex 93e68ba1e9..c438cdf44b 100644--- a/apps/desktop/src/components/grid/DataGrid.vue+++ b/apps/desktop/src/components/grid/DataGrid.vue@@ -1277,14 +1277,9 @@ let structuredFilterHydrationRequestId = 0;const draftStructuredWhereInput = ref("");const filterEditorView = computed(() => settingsStore.editorSettings.dataGridFilterEditorView);const isPersistentFilterView = computed(() => filterEditorView.value === "conditions" || filterEditorView.value === "text");-const isFilterEditorPinnedOpen = computed(() => isPersistentFilterView.value && settingsStore.editorSettings.dataGridKeepFilterEditorExpanded);-const effectiveFilterBuilderOpen = computed({- get: () => isFilterEditorPinnedOpen.value || filterBuilderOpen.value,- set: (open: boolean) => {- if (isFilterEditorPinnedOpen.value) return;- filterBuilderOpen.value = open;- },-});+// Keep the persisted preference as the initial state for persistent views, but+// do not use it as a lock: the toolbar toggle must always be able to close them.+filterBuilderOpen.value = isPersistentFilterView.value && settingsStore.editorSettings.dataGridKeepFilterEditorExpanded;const structuredFilterCount = computed(() => structuredFilterRules.value.filter((rule) => !rule.disabled && !!rule.columnName && filterModeHasCompleteValue(rule.mode, rule.rawValue, rule.rawEndValue)).length);const hasStructuredFilters = computed(() => !!combineWhereInputs(undefined, appliedStructuredWhereInput.value));interface ForeignKeyDisplayLabelState {@@ -1652,7 +1647,7 @@ function buildGroupedWhere(conditions: string[], rules: StructuredFilterRule[]):async function applyStructuredWhere(where: string) {appliedStructuredWhereInput.value = where;- if (!isFilterEditorPinnedOpen.value) filterBuilderOpen.value = false;+ if (filterEditorView.value === "quick") filterBuilderOpen.value = false;await applyWhereFilter();}@@ -1712,10 +1707,17 @@ function copyFilterSqlPreview() {watch([structuredFilterCacheKey, structuredFilterScopeKey], loadStructuredFilterStateForScope, { immediate: true });watch(filterEditorView, (view) => {- filterBuilderOpen.value = false;+ filterBuilderOpen.value = (view === "conditions" || view === "text") && settingsStore.editorSettings.dataGridKeepFilterEditorExpanded;if (view === "conditions" || view === "text") ensureStructuredFilterRule();});+watch(+ () => settingsStore.editorSettings.dataGridKeepFilterEditorExpanded,+ (expanded) => {+ if (isPersistentFilterView.value) filterBuilderOpen.value = expanded;+ },+);+const filterPreviewVisible = computed(() => canUseWhereSearch.value && (filterEditorView.value === "conditions" || filterEditorView.value === "text"));watch([filterPreviewVisible, structuredFilterRules],@@ -12202,7 +12204,7 @@ useUpdateBlocker(() => (hasPendingChanges.value || hasPendingDataEditorDraft.val<DataGridQueryControlsv-model:where-input="whereFilterInput"v-model:order-by-input="orderByInput"- v-model:filter-builder-open="effectiveFilterBuilderOpen"+ v-model:filter-builder-open="filterBuilderOpen":filter-editor-view="filterEditorView":columns="props.tableMeta?.columns.map((column) => column.name) ?? props.result.columns":condition-columns="conditionColumns"@@ -12372,7 +12374,7 @@ useUpdateBlocker(() => (hasPendingChanges.value || hasPendingDataEditorDraft.val</DataGridToolbar></div><DataGridFilterWorkbench- v-if="canUseWhereSearch && filterEditorView === 'conditions' && effectiveFilterBuilderOpen"+ v-if="canUseWhereSearch && filterEditorView === 'conditions' && filterBuilderOpen":sql-preview="filterSqlPreview":rules="structuredFilterRules":columns="filterBuilderColumnOptions"@@ -12394,7 +12396,7 @@ useUpdateBlocker(() => (hasPendingChanges.value || hasPendingDataEditorDraft.val@update-rule="updateStructuredFilterRule"/><DataGridTextFilterWorkbench- v-if="canUseWhereSearch && filterEditorView === 'text' && effectiveFilterBuilderOpen"+ v-if="canUseWhereSearch && filterEditorView === 'text' && filterBuilderOpen":height="settingsStore.editorSettings.dataGridTextFilterPanelHeight":sql-preview="filterSqlPreview":rules="structuredFilterRules"diff --git a/apps/desktop/src/components/grid/__tests__/DataGridFilterEditorState.spec.ts b/apps/desktop/src/components/grid/__tests__/DataGridFilterEditorState.spec.tsnew file mode 100644index 0000000000..a216f40e2e--- /dev/null+++ b/apps/desktop/src/components/grid/__tests__/DataGridFilterEditorState.spec.ts@@ -0,0 +1,205 @@+// @vitest-environment happy-dom++import { createApp, defineComponent, h, markRaw, nextTick, type App, type PropType } from "vue";+import { createPinia, setActivePinia } from "pinia";+import { afterEach, describe, expect, it, vi } from "vitest";+import i18n from "@/i18n";+import type { DataGridFilterEditorView } from "@/stores/settingsStore";+import type { QueryResult } from "@/types/database";+import { TooltipProvider } from "@/components/ui/tooltip";+import { clearDataGridStructuredFilterStates } from "@/lib/dataGrid/dataGridFilterBuilderPersistence";++const backendMocks = vi.hoisted(() => ({+ buildTableSelectSql: vi.fn(async ({ tableName, whereInput }: { tableName: string; whereInput?: string }) => `SELECT * FROM ${tableName}${whereInput ? ` WHERE ${whereInput}` : ""}`),+ loadEditorSettings: vi.fn().mockResolvedValue({}),+ saveEditorSettings: vi.fn().mockResolvedValue(undefined),+}));++vi.mock("@/lib/backend/api", async (importOriginal) => {+ const actual = await importOriginal<typeof import("@/lib/backend/api")>();+ return {+ ...actual,+ buildTableSelectSql: backendMocks.buildTableSelectSql,+ loadEditorSettings: backendMocks.loadEditorSettings,+ saveEditorSettings: backendMocks.saveEditorSettings,+ };+});++vi.mock("vue-virtual-scroller", async () => {+ const { defineComponent, h } = await import("vue");+ return {+ RecycleScroller: defineComponent({+ props: {+ items: {+ type: Array as PropType<unknown[]>,+ default: () => [],+ },+ },+ setup(props, { attrs, slots }) {+ return () =>+ h(+ "div",+ attrs,+ props.items.map((item) => slots.default?.({ item })),+ );+ },+ }),+ };+});++vi.mock("@/composables/useDataGridColumnResize", async (importOriginal) => {+ const actual = await importOriginal<typeof import("@/composables/useDataGridColumnResize")>();+ const { ref } = await import("vue");+ return {+ ...actual,+ useDataGridColumnResize: () => ({+ initColumnWidths: vi.fn(),+ onResizeStart: vi.fn(),+ autoFitColumn: vi.fn(),+ renderedColumnWidths: ref([120]),+ totalWidth: ref(120),+ columnVars: ref({ "--total-w": "120px" }),+ getIsResizing: () => false,+ }),+ };+});++import DataGrid from "../DataGrid.vue";+import { useSettingsStore } from "@/stores/settingsStore";++const mountedApps: Array<{ app: App; host: HTMLElement }> = [];++function panelSelector(view: DataGridFilterEditorView): string {+ return view === "conditions" ? "[data-grid-filter-workbench]" : "[data-grid-text-filter-workbench]";+}++function filterToggle(host: HTMLElement): HTMLButtonElement {+ const toggle = host.querySelector<HTMLButtonElement>('button[aria-label="Filter"][aria-expanded]');+ if (!toggle) throw new Error("Filter editor toggle not found");+ return toggle;+}++function applyButton(host: HTMLElement, view: DataGridFilterEditorView): HTMLButtonElement {+ const panel = host.querySelector(panelSelector(view));+ const button = [...(panel?.querySelectorAll<HTMLButtonElement>("button") ?? [])].find((candidate) => candidate.textContent?.trim() === "Apply Filter");+ if (!button) throw new Error("Filter editor apply button not found");+ return button;+}++function mountGrid(view: DataGridFilterEditorView, keepExpanded: boolean) {+ const pinia = createPinia();+ setActivePinia(pinia);+ const settingsStore = useSettingsStore();+ settingsStore.updateEditorSettings({+ dataGridRenderMode: "canvas",+ dataGridFilterEditorView: view,+ dataGridKeepFilterEditorExpanded: keepExpanded,+ });+ const result = markRaw<QueryResult>({+ columns: ["id"],+ rows: [[1]],+ affected_rows: 0,+ execution_time_ms: 0,+ });+ const onExecuteSql = vi.fn().mockResolvedValue(undefined);+ const host = document.createElement("div");+ document.body.append(host);+ const Root = defineComponent({+ setup() {+ return () =>+ h(+ TooltipProvider,+ { delayDuration: 0 },+ {+ default: () =>+ h(DataGrid, {+ result,+ databaseType: "mysql",+ context: "table-data",+ tableMeta: {+ tableName: "items",+ columns: [{ name: "id", data_type: "int" }],+ primaryKeys: ["id"],+ },+ onExecuteSql,+ }),+ },+ );+ },+ });+ const app = createApp(Root);+ app.use(pinia);+ app.use(i18n);+ app.mount(host);+ mountedApps.push({ app, host });+ return { host, onExecuteSql };+}++async function settle() {+ await nextTick();+ await Promise.resolve();+ await nextTick();+}++afterEach(() => {+ for (const { app, host } of mountedApps.splice(0)) {+ app.unmount();+ host.remove();+ }+ clearDataGridStructuredFilterStates();+});++describe.each(["conditions", "text"] as const)("DataGrid %s filter editor state", (view) => {+ it("keeps a manually opened editor open after apply and still allows manual close", async () => {+ const { host, onExecuteSql } = mountGrid(view, false);+ await settle();++ expect(host.querySelector(panelSelector(view))).toBeNull();+ filterToggle(host).click();+ await settle();+ expect(host.querySelector(panelSelector(view))).not.toBeNull();++ applyButton(host, view).click();+ await vi.waitFor(() => expect(onExecuteSql).toHaveBeenCalledOnce());+ expect(host.querySelector(panelSelector(view))).not.toBeNull();++ filterToggle(host).click();+ await settle();+ expect(host.querySelector(panelSelector(view))).toBeNull();+ });++ it("uses the persisted expansion preference only as the initial state", async () => {+ const { host } = mountGrid(view, true);+ await settle();++ expect(host.querySelector(panelSelector(view))).not.toBeNull();+ expect(filterToggle(host).getAttribute("aria-expanded")).toBe("true");++ filterToggle(host).click();+ await settle();+ expect(host.querySelector(panelSelector(view))).toBeNull();++ filterToggle(host).click();+ await settle();+ expect(host.querySelector(panelSelector(view))).not.toBeNull();+ });+});++describe("DataGrid quick filter editor state", () => {+ it("continues to close its popover after apply", async () => {+ const { host, onExecuteSql } = mountGrid("quick", true);+ await settle();++ const toggle = filterToggle(host);+ expect(toggle.getAttribute("aria-expanded")).toBe("false");+ toggle.click();+ await settle();+ expect(toggle.getAttribute("aria-expanded")).toBe("true");++ const apply = [...document.querySelectorAll<HTMLButtonElement>("button")].find((candidate) => candidate.textContent?.trim() === "Apply Filter");+ if (!apply) throw new Error("Quick filter apply button not found");+ apply.click();+ await vi.waitFor(() => expect(onExecuteSql).toHaveBeenCalledOnce());+ expect(toggle.getAttribute("aria-expanded")).toBe("false");+ });+});diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.tsindex 1502851c0e..3853ef67a7 100644--- a/apps/desktop/src/i18n/locales/en.ts+++ b/apps/desktop/src/i18n/locales/en.ts@@ -7979,8 +7979,8 @@ export default {dataGridToolbarLayoutSingle: "Single row (original layout)",dataGridFilterView: "Table filter view",dataGridFilterViewDescription: "Use a filter popover, a fixed conditions panel, or a compact text conditions panel.",- dataGridKeepFilterEditorExpanded: "Keep filter editor expanded",- dataGridKeepFilterEditorExpandedDescription: "Always keep the editor expanded in Conditions and Text views.",+ dataGridKeepFilterEditorExpanded: "Expand filter editor by default",+ dataGridKeepFilterEditorExpandedDescription: "Open the editor initially in Conditions and Text views. You can still collapse it manually.",dataGridFilterViewPreview: "Effect preview",dataGridFilterViewPreviewExpand: "Expand effect preview",dataGridFilterViewPreviewCollapse: "Collapse effect preview",diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.tsindex 04d9d29803..b6c5b4af97 100644--- a/apps/desktop/src/i18n/locales/es.ts+++ b/apps/desktop/src/i18n/locales/es.ts@@ -8307,8 +8307,8 @@ export default withEnglishFallback({customUiBorder: "Borde",customUiSidebar: "Barra lateral",shortcutConvertNamingStyle: "Cambiar estilo de nomenclatura",- dataGridKeepFilterEditorExpanded: "Mantener expandido el editor de filtros",- dataGridKeepFilterEditorExpandedDescription: "Mantiene siempre expandido el editor en las vistas Condiciones y Texto.",+ dataGridKeepFilterEditorExpanded: "Expandir el editor de filtros de forma predeterminada",+ dataGridKeepFilterEditorExpandedDescription: "Abre inicialmente el editor en las vistas Condiciones y Texto; aún puedes contraerlo manualmente.",mcpQueryTimeoutSaveStatus_saving: "Guardando...",mcpQueryTimeoutSaveStatus_saved: "Guardado",mcpQueryTimeoutSaveStatus_failed: "Error al guardar",diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.tsindex 42c99ca884..76a827963f 100644--- a/apps/desktop/src/i18n/locales/it.ts+++ b/apps/desktop/src/i18n/locales/it.ts@@ -8232,8 +8232,8 @@ export default withEnglishFallback({customUiBorder: "Bordo",customUiSidebar: "Barra laterale",shortcutConvertNamingStyle: "Cambia stile di denominazione",- dataGridKeepFilterEditorExpanded: "Mantieni espanso l'editor dei filtri",- dataGridKeepFilterEditorExpandedDescription: "Mantiene sempre espanso l'editor nelle viste Condizioni e Testo.",+ dataGridKeepFilterEditorExpanded: "Espandi l'editor dei filtri per impostazione predefinita",+ dataGridKeepFilterEditorExpandedDescription: "Apre inizialmente l'editor nelle viste Condizioni e Testo; puoi comunque comprimerlo manualmente.",mcpQueryTimeoutSaveStatus_saving: "Salvataggio in corso...",mcpQueryTimeoutSaveStatus_saved: "Salvato",mcpQueryTimeoutSaveStatus_failed: "Salvataggio non riuscito",diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.tsindex 8ea928fd8d..93f50323e2 100644--- a/apps/desktop/src/i18n/locales/ja.ts+++ b/apps/desktop/src/i18n/locales/ja.ts@@ -8281,8 +8281,8 @@ export default withEnglishFallback({customUiBorder: "枠線",customUiSidebar: "サイドバー",shortcutConvertNamingStyle: "命名スタイルの切り替え",- dataGridKeepFilterEditorExpanded: "フィルターエディターを常に展開する",- dataGridKeepFilterEditorExpandedDescription: "条件ビューとテキストビューでエディターを常に展開します。",+ dataGridKeepFilterEditorExpanded: "フィルターエディターを既定で展開",+ dataGridKeepFilterEditorExpandedDescription: "条件ビューとテキストビューでエディターを初期表示時に展開します。手動で折りたたむこともできます。",mcpQueryTimeoutSaveStatus_saving: "保存中...",mcpQueryTimeoutSaveStatus_saved: "保存済み",mcpQueryTimeoutSaveStatus_failed: "保存失敗",diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.tsindex 50a018990d..5db094bed1 100644--- a/apps/desktop/src/i18n/locales/ko.ts+++ b/apps/desktop/src/i18n/locales/ko.ts@@ -7984,8 +7984,8 @@ export default withEnglishFallback({csvQuoteModeAll: "모든 필드",csvQuoteModeNecessary: "필수 필드만",shortcutConvertNamingStyle: "네이밍 스타일 전환",- dataGridKeepFilterEditorExpanded: "필터 편집기 항상 펼치기",- dataGridKeepFilterEditorExpandedDescription: "조건 및 텍스트 보기에서 편집기를 항상 펼칩니다.",+ dataGridKeepFilterEditorExpanded: "필터 편집기 기본 펼치기",+ dataGridKeepFilterEditorExpandedDescription: "조건 및 텍스트 보기에서 편집기를 처음에 펼칩니다. 수동으로 접을 수도 있습니다.",mcpQueryTimeoutSaveStatus_saving: "저장 중...",mcpQueryTimeoutSaveStatus_saved: "저장됨",mcpQueryTimeoutSaveStatus_failed: "저장 실패",diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.tsindex e8622281c1..f15bf36e97 100644--- a/apps/desktop/src/i18n/locales/pt-BR.ts+++ b/apps/desktop/src/i18n/locales/pt-BR.ts@@ -8233,8 +8233,8 @@ export default withEnglishFallback({customUiBorder: "Borda",customUiSidebar: "Barra lateral",shortcutConvertNamingStyle: "Alternar estilo de nomenclatura",- dataGridKeepFilterEditorExpanded: "Manter o editor de filtros expandido",- dataGridKeepFilterEditorExpandedDescription: "Mantém o editor sempre expandido nas visualizações Condições e Texto.",+ dataGridKeepFilterEditorExpanded: "Expandir editor de filtros por padrão",+ dataGridKeepFilterEditorExpandedDescription: "Abre inicialmente o editor nas visualizações Condições e Texto; ainda é possível recolhê-lo manualmente.",mcpQueryTimeoutSaveStatus_saving: "Salvando...",mcpQueryTimeoutSaveStatus_saved: "Salvo",mcpQueryTimeoutSaveStatus_failed: "Falha ao salvar",diff --git a/apps/desktop/src/i18n/locales/ru.ts b/apps/desktop/src/i18n/locales/ru.tsindex 8fa0664652..cd992fab39 100644--- a/apps/desktop/src/i18n/locales/ru.ts+++ b/apps/desktop/src/i18n/locales/ru.ts@@ -8513,8 +8513,8 @@ export default withEnglishFallback({dataGridToolbarLayoutSingle: "Одна строка (исходный макет)",dataGridFilterView: "Вид фильтра таблицы",dataGridFilterViewDescription: "Используйте всплывающее окно фильтра, фиксированную панель условий или компактную текстовую панель условий.",- dataGridKeepFilterEditorExpanded: "Держать редактор фильтра развёрнутым",- dataGridKeepFilterEditorExpandedDescription: "Всегда держать редактор развёрнутым в видах «Условия» и «Текст».",+ dataGridKeepFilterEditorExpanded: "Разворачивать редактор фильтра по умолчанию",+ dataGridKeepFilterEditorExpandedDescription: "Изначально разворачивает редактор в режимах «Условия» и «Текст»; его по-прежнему можно свернуть вручную.",dataGridFilterViewPreview: "Предпросмотр результата",dataGridFilterViewPreviewExpand: "Развернуть предпросмотр",dataGridFilterViewPreviewCollapse: "Свернуть предпросмотр",diff --git a/apps/desktop/src/i18n/locales/tr.ts b/apps/desktop/src/i18n/locales/tr.tsindex a66c7206f3..1877a033c8 100644--- a/apps/desktop/src/i18n/locales/tr.ts+++ b/apps/desktop/src/i18n/locales/tr.ts@@ -7209,8 +7209,8 @@ export default withEnglishFallback({dataGridDisplay: "Veri tablosu görünümü",dataGridFilterView: "Tablo filtresi görünümü",dataGridFilterViewDescription: "Filtre açılır penceresi, sabit koşullar paneli ya da sıkışık metin koşulları paneli kullanın.",- dataGridKeepFilterEditorExpanded: "Filtre düzenleyicisini açık tut",- dataGridKeepFilterEditorExpandedDescription: "Koşullar ve Metin görünümlerinde düzenleyiciyi her zaman açık tutar.",+ dataGridKeepFilterEditorExpanded: "Filtre düzenleyicisini varsayılan olarak aç",+ dataGridKeepFilterEditorExpandedDescription: "Koşullar ve Metin görünümlerinde düzenleyiciyi başlangıçta açar; yine de elle kapatabilirsiniz.",dataGridFilterViewPreview: "Etki önizlemesi",dataGridFilterViewPreviewExpand: "Etki önizlemesini genişlet",dataGridFilterViewPreviewCollapse: "Etki önizlemesini daralt",diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.tsindex d95ad54018..36f714bce5 100644--- a/apps/desktop/src/i18n/locales/zh-CN.ts+++ b/apps/desktop/src/i18n/locales/zh-CN.ts@@ -7951,8 +7951,8 @@ export default withEnglishFallback({dataGridToolbarLayoutSingle: "单行显示(原布局)",dataGridFilterView: "表格筛选视图",dataGridFilterViewDescription: "选择弹出式快捷筛选、固定条件面板或紧凑文本条件面板。",- dataGridKeepFilterEditorExpanded: "筛选编辑器常驻展开",- dataGridKeepFilterEditorExpandedDescription: "始终在条件视图和文本视图中展开编辑器。",+ dataGridKeepFilterEditorExpanded: "默认展开筛选编辑器",+ dataGridKeepFilterEditorExpandedDescription: "在条件视图和文本视图中初始展开编辑器;仍可手动折叠。",dataGridFilterViewPreview: "效果预览",dataGridFilterViewPreviewExpand: "展开效果预览",dataGridFilterViewPreviewCollapse: "收起效果预览",diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.tsindex e070884e0f..34107e589c 100644--- a/apps/desktop/src/i18n/locales/zh-TW.ts+++ b/apps/desktop/src/i18n/locales/zh-TW.ts@@ -7558,8 +7558,8 @@ export default withEnglishFallback({customUiBorder: "邊框",customUiSidebar: "側邊欄",shortcutConvertNamingStyle: "切換命名風格",- dataGridKeepFilterEditorExpanded: "篩選編輯器常駐展開",- dataGridKeepFilterEditorExpandedDescription: "始終在條件檢視和文字檢視中展開編輯器。",+ dataGridKeepFilterEditorExpanded: "預設展開篩選編輯器",+ dataGridKeepFilterEditorExpandedDescription: "在條件檢視和文字檢視中初始展開編輯器;仍可手動收合。",mcpQueryTimeoutSaveStatus_saving: "儲存中...",mcpQueryTimeoutSaveStatus_saved: "已儲存",mcpQueryTimeoutSaveStatus_failed: "儲存失敗",diff --git a/apps/desktop/src/stores/__tests__/settingsStore.spec.ts b/apps/desktop/src/stores/__tests__/settingsStore.spec.tsindex 66aebc9139..fe0e17468a 100644--- a/apps/desktop/src/stores/__tests__/settingsStore.spec.ts+++ b/apps/desktop/src/stores/__tests__/settingsStore.spec.ts@@ -59,7 +59,7 @@ describe("normalizeEditorSettings", () => {expect(normalizeEditorSettings({ dataGridToolbarLayout: "invalid" } as any).dataGridToolbarLayout).toBe("single");});- it("keeps filter editor expansion disabled unless explicitly enabled", () => {+ it("keeps initial filter editor expansion disabled unless explicitly enabled", () => {expect(normalizeEditorSettings({}).dataGridKeepFilterEditorExpanded).toBe(false);expect(normalizeEditorSettings({ dataGridKeepFilterEditorExpanded: true }).dataGridKeepFilterEditorExpanded).toBe(true);expect(normalizeEditorSettings({ dataGridKeepFilterEditorExpanded: false }).dataGridKeepFilterEditorExpanded).toBe(false);@@ -68,10 +68,17 @@ describe("normalizeEditorSettings", () => {expect(normalizeEditorSettings({ dataGridKeepFilterEditorExpanded: "true", dataGridAutoHideFilterBuilder: false } as any).dataGridKeepFilterEditorExpanded).toBe(false);});- it("migrates the legacy auto-hide preference when the current preference is absent", () => {+ it("normalizes the legacy auto-hide preference into the initial expansion preference", () => {expect(normalizeEditorSettings({ dataGridAutoHideFilterBuilder: false } as any).dataGridKeepFilterEditorExpanded).toBe(true);expect(normalizeEditorSettings({ dataGridAutoHideFilterBuilder: true } as any).dataGridKeepFilterEditorExpanded).toBe(false);expect(normalizeEditorSettings({ dataGridKeepFilterEditorExpanded: false, dataGridAutoHideFilterBuilder: false } as any).dataGridKeepFilterEditorExpanded).toBe(false);+ expect(normalizeEditorSettings({ dataGridKeepFilterEditorExpanded: true, dataGridAutoHideFilterBuilder: true } as any).dataGridKeepFilterEditorExpanded).toBe(true);+ });++ it("ignores malformed legacy auto-hide values during expansion normalization", () => {+ expect(normalizeEditorSettings({ dataGridAutoHideFilterBuilder: "false" } as any).dataGridKeepFilterEditorExpanded).toBe(false);+ expect(normalizeEditorSettings({ dataGridAutoHideFilterBuilder: 0 } as any).dataGridKeepFilterEditorExpanded).toBe(false);+ expect(normalizeEditorSettings({ dataGridAutoHideFilterBuilder: null } as any).dataGridKeepFilterEditorExpanded).toBe(false);});it("normalizes persisted tab group names and colors", () => {diff --git a/apps/desktop/src/stores/settingsStore.ts b/apps/desktop/src/stores/settingsStore.tsindex d761f9ba9d..634d3c6ec1 100644--- a/apps/desktop/src/stores/settingsStore.ts+++ b/apps/desktop/src/stores/settingsStore.ts@@ -884,6 +884,7 @@ export interface EditorSettings {dataGridQuickEntry: boolean;dataGridFilterEditorView: DataGridFilterEditorView;dataGridToolbarLayout: DataGridToolbarLayout;+ /** Opens Conditions/Text filter editors initially; users can still collapse them. */dataGridKeepFilterEditorExpanded: boolean;dataGridTextFilterPanelHeight: number;localFilterPopoverWidth: number;@@ -1875,8 +1876,8 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, exist/*** Cloud snapshots are applied as partial settings updates rather than loaded- * through `normalizeEditorSettings`. Translate the removed inverse flag here- * so older snapshots retain their behavior on every incremental update path.+ * through `normalizeEditorSettings`. Translate the removed inverse flag into+ * the current initial-expansion preference on every incremental update path.*/function migrateLegacyFilterEditorExpansionPatch(partial: Partial<EditorSettings>): Partial<EditorSettings> {const patch = partial as Partial<EditorSettings> & { dataGridAutoHideFilterBuilder?: unknown };