fix(plugins): refresh workbench tabs after install and rollback

This commit is contained in:
U1 authored and GitHub committed 2026-09-18 21:31:38 +08:00
1 parent f033e50ef5
commit 6be8d5544e
6 files changed
+159 -5

No files matched your search

+13 -1
View File
@@ -1010,6 +1010,7 @@ const { setupTauriListeners, cleanupTauriListeners } = useTauriEvents({
closeActiveSurface,
openAiConfigDeepLink,
openPluginInstallDeepLink,
refreshPluginWorkbenches,
});
const { showCloseActionPrompt, chooseQuit, chooseMinimize, cancelCloseActionPrompt, performCloseAction, setupCloseActionPromptListener, cleanupCloseActionPromptListener } = useCloseActionPrompt({ requestClose: requestAppClose });
useVisibilityChange();
@@ -3286,6 +3287,17 @@ function refreshActivePluginWorkbench(): boolean {
return true;
}
// Installs/rollbacks replace the plugin runtime in place; already-open
// workbench tabs keep rendering the previous UI bundle until they reload.
// refresh() re-fetches listPlugins, and PluginWorkbenchHost's version watch
// rebuilds the sandbox iframe from the new package.
function refreshPluginWorkbenches(pluginId: string): void {
for (const tab of mountedPluginWorkbenchTabs.value) {
if (tab.pluginWorkbench?.pluginId !== pluginId) continue;
pluginWorkbenchTabRefs.get(tab.id)?.refresh();
}
}
async function closeActiveSurface() {
if (showSettingsPage.value) {
closeSettingsPage();
@@ -3839,7 +3851,7 @@ onUnmounted(() => {
@detach-tab="detachTab"
>
<DriverStorePage v-if="driverStoreTabOpen" v-show="driverStoreActive" v-model:active-tab="driverStoreActiveTab" class="flex-1 min-h-0" :update-notifications-enabled="updateNotificationsEnabled" :focus-target="driverStoreFocus" @update-count-change="updateAgentDriverUpdateCount" />
<PluginCenterPage v-if="pluginCenterTabOpen" v-show="pluginCenterActive" class="flex-1 min-h-0" :focus-target="pluginCenterFocus" :install-url-request="pluginCenterInstallRequest" @new-connection="openPluginConnectionDialog" />
<PluginCenterPage v-if="pluginCenterTabOpen" v-show="pluginCenterActive" class="flex-1 min-h-0" :focus-target="pluginCenterFocus" :install-url-request="pluginCenterInstallRequest" @new-connection="openPluginConnectionDialog" @plugin-runtime-replaced="refreshPluginWorkbenches" />
<EditorSettingsPage
v-if="settingsPageTabOpen"
v-show="settingsStore.settingsPageActive"