Skip to content

Commit 10dd274

Browse files
committed
Push client and server to the top
1 parent 6db96f7 commit 10dd274

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/components/DeclarationsSidebar.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ function groupByModule(declarations: Declaration[]): ModuleGroup[] {
2929
}
3030
items.push(d);
3131
}
32-
return Array.from(map, ([module, items]) => ({ module, items })).sort((a, b) =>
33-
a.module.localeCompare(b.module),
34-
);
32+
const priority = ["client", "server"];
33+
return Array.from(map, ([module, items]) => ({ module, items })).sort((a, b) => {
34+
const ai = priority.indexOf(a.module);
35+
const bi = priority.indexOf(b.module);
36+
if (ai !== bi) return (ai === -1 ? Infinity : ai) - (bi === -1 ? Infinity : bi);
37+
return a.module.localeCompare(b.module);
38+
});
3539
}
3640

3741
const HEADER_HEIGHT = 28;

0 commit comments

Comments
 (0)