Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

feat: persist page size setting across restarts

t8y203e2c0bea1f4
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 {