docs(modules): note the registry is the checklist for new pages

Review follow-up: the ordered MODULES array can't double as a compiler-
enforced exhaustive Page map, so document that adding a Page means adding it
here (an unregistered Page returns undefined from moduleDef/moduleLabelKey and
throws in NavSidebar). No behavior change. (Platform S6b.2)
This commit is contained in:
2026-07-19 00:16:17 +02:00
parent a303f307cd
commit d33a838462
+4
View File
@@ -65,6 +65,10 @@ const SETTINGS_MODULE: ModuleDef = {
icon: Settings,
};
// Registering a NEW Page means adding it to MODULES (or SETTINGS_MODULE) above — that's the single
// place. If a Page is left unregistered, moduleDef()/moduleLabelKey[] return undefined and NavSidebar
// throws on `.icon`; the coverage isn't compiler-enforced here because the ordered array can't also
// be an exhaustive Page map, so treat the array as the checklist when the Page union grows.
const BY_ID = Object.fromEntries(
[...MODULES, SETTINGS_MODULE].map((m) => [m.id, m]),
) as Record<Page, ModuleDef>;