From 03e2c0bea1f4518e49f0a079271dd436d9bb663e Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Thu, 14 May 2026 20:48:28 +0800 Subject: [PATCH] feat: persist page size setting across restarts Store the data grid page size in EditorSettings (localStorage) so the user's chosen rows-per-page survives app restarts. --- src/components/grid/DataGrid.vue | 5 ++++- src/stores/settingsStore.ts | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/grid/DataGrid.vue b/src/components/grid/DataGrid.vue index f14e45b449..72d03efe63 100644 --- a/src/components/grid/DataGrid.vue +++ b/src/components/grid/DataGrid.vue @@ -84,8 +84,10 @@ import { useDataGridExport } from "@/composables/useDataGridExport"; import { useDataGridColumnResize } from "@/composables/useDataGridColumnResize"; import { useDataGridSelection } from "@/composables/useDataGridSelection"; import { useDataGridEditor } from "@/composables/useDataGridEditor"; +import { useSettingsStore } from "@/stores/settingsStore"; const { t } = useI18n(); +const settingsStore = useSettingsStore(); const { toast } = useToast(); const props = defineProps<{ @@ -825,7 +827,7 @@ watch( ); // --- Pagination --- -const pageSize = ref(100); +const pageSize = ref(settingsStore.editorSettings.pageSize); const currentPage = ref(1); const isFullPage = computed(() => props.result.rows.length >= pageSize.value); const isResultsContext = computed(() => props.context === "results"); @@ -909,6 +911,7 @@ function nextPage() { } function changePageSize(size: number) { pageSize.value = size; + settingsStore.updateEditorSettings({ pageSize: size }); currentPage.value = 1; resetGridVerticalScroll(true); emit("paginate", 0, size, currentWhereInput(), currentOrderBy()); diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts index 3a59524688..c63cf624e1 100644 --- a/src/stores/settingsStore.ts +++ b/src/stores/settingsStore.ts @@ -50,6 +50,7 @@ export interface EditorSettings { executeMode: "all" | "current"; wordWrap: boolean; appLayout: "separated" | "classic"; + pageSize: number; } export const EDITOR_THEMES: { value: EditorTheme; label: string; dark: boolean }[] = [ @@ -81,6 +82,7 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettings = { executeMode: "all", wordWrap: false, appLayout: "classic", + pageSize: 100, }; export const STORAGE_KEY = "dbx-editor-settings"; @@ -99,6 +101,7 @@ function loadEditorSettings(): EditorSettings { executeMode: parsed.executeMode ?? DEFAULT_EDITOR_SETTINGS.executeMode, wordWrap: parsed.wordWrap ?? DEFAULT_EDITOR_SETTINGS.wordWrap, appLayout: parsed.appLayout ?? DEFAULT_EDITOR_SETTINGS.appLayout, + pageSize: parsed.pageSize ?? DEFAULT_EDITOR_SETTINGS.pageSize, }; } } catch {