From 7b7d21f54fe0b1b7c25f9a679acad165dc86b529 Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Sun, 13 Sep 2026 12:35:04 +0800 Subject: [PATCH] fix(plugin): defer restored tabs until manual refresh --- .../src/components/layout/ContentArea.vue | 20 ++++++-- .../components/plugins/PluginFileManager.vue | 2 + .../plugins/PluginFilesystemTab.vue | 48 ++++++++++++++++--- .../components/plugins/PluginRefreshState.vue | 28 +++++++++++ .../components/plugins/PluginWorkbenchTab.vue | 42 +++++++++++++--- apps/desktop/src/i18n/locales/en.ts | 3 ++ apps/desktop/src/i18n/locales/es.ts | 3 ++ apps/desktop/src/i18n/locales/it.ts | 3 ++ apps/desktop/src/i18n/locales/ja.ts | 3 ++ apps/desktop/src/i18n/locales/ko.ts | 3 ++ apps/desktop/src/i18n/locales/pt-BR.ts | 3 ++ apps/desktop/src/i18n/locales/zh-CN.ts | 3 ++ apps/desktop/src/i18n/locales/zh-TW.ts | 3 ++ 13 files changed, 148 insertions(+), 16 deletions(-) create mode 100644 apps/desktop/src/components/plugins/PluginRefreshState.vue diff --git a/apps/desktop/src/components/layout/ContentArea.vue b/apps/desktop/src/components/layout/ContentArea.vue index c180fe73d0..36ec0a082f 100644 --- a/apps/desktop/src/components/layout/ContentArea.vue +++ b/apps/desktop/src/components/layout/ContentArea.vue @@ -208,6 +208,10 @@ type SearchableBrowserHandle = { executeCommand?: (command: string) => Promise; }; +type PluginTabHandle = { + refresh?: () => Promise | void; +}; + type ElasticsearchJsonResponsePanelHandle = { focusSearch: () => boolean; }; @@ -323,6 +327,8 @@ const consulOverviewRef = ref<{ refresh?: () => boolean }>(); const consulWorkspaceRef = ref(); const databaseBrowserRef = ref(); const objectBrowserRef = ref(); +const pluginWorkbenchRef = ref(); +const pluginFilesystemRef = ref(); const activeTableMeta = computed(() => props.activeTab.tableMeta); const activeDataTabTableMeta = computed(() => tableMetaForDataTab(props.activeTab)); const activeResultExecutionTarget = computed(() => queryStore.activeResultExecutionTarget(props.activeTab.id)); @@ -961,6 +967,12 @@ function refreshData(): boolean { if (props.activeTab.mode === "consul-overview") return consulOverviewRef.value?.refresh?.() ?? false; if (props.activeTab.mode === "consul") return consulWorkspaceRef.value?.refresh?.() ?? false; if (props.activeTab.mode === "databases") return databaseBrowserRef.value?.refresh?.() ?? false; + if (props.activeTab.mode === "plugin-workbench" || props.activeTab.mode === "plugin-filesystem") { + const pluginTab = props.activeTab.mode === "plugin-workbench" ? pluginWorkbenchRef.value : pluginFilesystemRef.value; + if (!pluginTab?.refresh) return false; + void pluginTab.refresh(); + return true; + } // Restored data tabs intentionally omit row data, so refresh must work before DataGrid mounts. if (canReloadUnavailableDataTab(props.activeTab)) { reloadUnavailableDataTab(); @@ -1186,6 +1198,7 @@ function handleModRTarget(target: Element): boolean { if (target.closest("[data-cell-detail-editor-root]")) return dataGridRef.value?.openCellDetailSearch() ?? false; if (target.closest("[data-grid-root], [data-elasticsearch-json-response-root]")) return refreshData(); if (canReloadUnavailableDataTab(props.activeTab)) return refreshData(); + if (props.activeTab.mode === "plugin-workbench" || props.activeTab.mode === "plugin-filesystem") return refreshData(); return false; } @@ -2527,13 +2540,14 @@ defineExpose({