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

@@ -34,6 +34,7 @@ describe("useTauriEvents", () => {
openDbFilePath: vi.fn(),
openConnectionDeepLink: vi.fn(),
closeActiveSurface,
refreshPluginWorkbenches: vi.fn(),
});
events.setupTauriListeners();
@@ -44,4 +45,23 @@ describe("useTauriEvents", () => {
events.cleanupTauriListeners();
expect(unlisten).toHaveBeenCalled();
});
it("forwards replaced plugin runtimes to the workbench refresh hook", async () => {
const refreshPluginWorkbenches = vi.fn();
const events = useTauriEvents({
openTableTarget: vi.fn(),
openSqlFilePath: vi.fn(),
openDbFilePath: vi.fn(),
openConnectionDeepLink: vi.fn(),
closeActiveSurface: vi.fn(),
refreshPluginWorkbenches,
});
events.setupTauriListeners();
await vi.waitFor(() => expect(listeners.has("plugin-runtime-replaced")).toBe(true));
listeners.get("plugin-runtime-replaced")!({ payload: { pluginId: "io.example.plugin", version: "0.2.0" } });
expect(refreshPluginWorkbenches).toHaveBeenCalledExactlyOnceWith("io.example.plugin");
events.cleanupTauriListeners();
});
});