From 04e68f6a123f775f50a17ffbab6576b99a5d7fed Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Sun, 29 Nov 2026 17:28:37 +0800 Subject: [PATCH] fix(plugins): keep a plugin's settings pages in manifest order (#6828) A plugin's settings sub-pages registered without an order, so the settings tree sorted them by title. They now keep the order the manifest lists them in, so no new manifest field is needed. Part of #6745. --- src/features/plugins/__tests__/settings.test.tsx | 6 ++++++ src/features/plugins/settings.tsx | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/features/plugins/__tests__/settings.test.tsx b/src/features/plugins/__tests__/settings.test.tsx index 9909b3725d..fa9a88d7b5 100644 --- a/src/features/plugins/__tests__/settings.test.tsx +++ b/src/features/plugins/__tests__/settings.test.tsx @@ -118,6 +118,12 @@ it("registers searchable child pages and removes all of them on unload", () => { expect([...useSettingsPages.getState().pages.keys()].some((k) => k.startsWith("plugins.example-helper"))).toBe(false); }); +it("orders child pages as the manifest lists them, not by title", () => { + const pages = useSettingsPages.getState().pages; + const order = (page: string) => pages.get(`plugins.example-helper.settings:${page}`)!.order; + expect(["templates", "llm", "defaults", "server"].map(order)).toEqual([0, 1, 2, 3]); +}); + it("stages table edits, keeps changes between pages and discards them on Cancel", () => { const view = render(); expect(screen.getByRole("heading", { name: "Provider" })).toBeInTheDocument(); diff --git a/src/features/plugins/settings.tsx b/src/features/plugins/settings.tsx index a102e1bd85..9bb8c0f3fa 100644 --- a/src/features/plugins/settings.tsx +++ b/src/features/plugins/settings.tsx @@ -498,9 +498,11 @@ export function projectSettings(pluginId: string, decl: SettingsDecl): () => voi keywords: ["plugin", pluginId, ...keywords(decl)], component: pages.length ? undefined : settingsPage(pluginId, decl), }, - ...pages.map((p) => ({ + // In the manifest's order, not alphabetically by title. + ...pages.map((p, i) => ({ id: `${id}.settings:${p.id}`, title: p.title, + order: i, projectScope: true, keywords: [pluginId, decl.title, ...keywords(p)], component: settingsPage(pluginId, p),