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.
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-11-29 17:28:37 +08:00
1 джерело 4cfc794f60
коміт 04e68f6a12
2 files changed
+9 -1

No files matched your search

+6
Переглянути файл
@@ -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(<Harness page="llm" />);
expect(screen.getByRole("heading", { name: "Provider" })).toBeInTheDocument();
+3 -1
Переглянути файл
@@ -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),