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),