From 28f4aec50da9efa273a7767fabe69d25c4f9826f Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Mon, 18 May 2026 16:20:19 +0800 Subject: [PATCH] fix(shortcuts): refresh data with F5 --- apps/desktop/src/App.vue | 7 +++++++ apps/desktop/src/components/layout/ContentArea.vue | 8 +++++++- apps/desktop/src/i18n/locales/en.ts | 1 + apps/desktop/src/i18n/locales/es.ts | 1 + apps/desktop/src/i18n/locales/zh-CN.ts | 1 + apps/desktop/src/lib/keyboardShortcuts.ts | 4 ++++ apps/desktop/src/lib/shortcutRegistry.ts | 8 +++++++- packages/app-tests/keyboardShortcuts.test.ts | 13 +++++++++++++ packages/app-tests/settingsStore.test.ts | 1 + 9 files changed, 42 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vue index 34bafd8f0c..54fc0bf19e 100644 --- a/apps/desktop/src/App.vue +++ b/apps/desktop/src/App.vue @@ -43,6 +43,7 @@ import { isExecuteSqlShortcut, isFocusSearchShortcut, isObjectSourceSaveShortcutTarget, + isRefreshDataShortcut, isSaveShortcut, } from "@/lib/keyboardShortcuts"; import { isPreviewTab } from "@/lib/tabPresentation"; @@ -562,6 +563,12 @@ function handleKeydown(e: KeyboardEvent) { } return; } + if (isRefreshDataShortcut(e, shortcuts)) { + e.preventDefault(); + e.stopPropagation(); + contentAreaRef.value?.refreshData(); + return; + } if (isCloseTabShortcut(e, shortcuts)) { e.preventDefault(); if (showDriverStore.value) { diff --git a/apps/desktop/src/components/layout/ContentArea.vue b/apps/desktop/src/components/layout/ContentArea.vue index c83a101c5d..0f3498a4b6 100644 --- a/apps/desktop/src/components/layout/ContentArea.vue +++ b/apps/desktop/src/components/layout/ContentArea.vue @@ -198,7 +198,13 @@ function focusSearch(): boolean { return dataGridRef.value?.focusSearch() ?? false; } -defineExpose({ focusSearch }); +function refreshData(): boolean { + if (!dataGridRef.value) return false; + void dataGridRef.value.onToolbarRefresh(); + return true; +} + +defineExpose({ focusSearch, refreshData });