fix(webui): cache tool catalogs across settings navigation (#6552)

* fix(webui): cache tool catalogs across settings navigation

* refactor(webui): remove unreachable catalog invalidation condition
This commit is contained in:
chengyongru authored and GitHub committed 2026-11-04 00:30:33 +08:00
1 parent 62c2ed4e7e
commit 8632940a99
15 files changed
+424 -31

No files matched your search

+8 -2
View File
@@ -1,4 +1,4 @@
import { act, fireEvent, screen, waitFor, within } from "@testing-library/react";
import { act, cleanup, fireEvent, screen, waitFor, within } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import i18n from "@/i18n";
@@ -423,11 +423,17 @@ describe("SettingsView Apps catalog", () => {
});
vi.stubGlobal("fetch", fetchMock);
renderSettingsView({ initialSection: "apps" });
const client = { requestMutation: requestMutationMock, status: "open", onStatus: () => () => {} } as never;
renderSettingsView({ client, initialSection: "apps" });
fireEvent.click(await screen.findByRole("button", { name: "MCP" }));
expect(await screen.findByRole("button", { name: "Xmind" }))
.toHaveAccessibleDescription("Connecting…");
cleanup();
renderSettingsView({ client, initialSection: "apps", initialSettings: settingsPayload() });
fireEvent.click(screen.getByRole("button", { name: "MCP" }));
expect(screen.getByRole("button", { name: "Xmind" })).toHaveAccessibleDescription("Connecting…");
expect(mcpPresetRequests).toBe(1);
expect(await screen.findByRole(
"button",
{ name: "Manage Xmind" },