Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
refactor: resolve digital twin group sections once at module load
[._.]/ Adam Eivyf046cfe11e7c
diff --git a/client/src/components/digital-twin/SectionNav.test.jsx b/client/src/components/digital-twin/SectionNav.test.jsxindex 3ddc75b488..254e46caab 100644--- a/client/src/components/digital-twin/SectionNav.test.jsx+++ b/client/src/components/digital-twin/SectionNav.test.jsx@@ -33,6 +33,11 @@ describe('digital-twin section taxonomy', () => {expect(sectionGroupId('not-a-section')).toBe(SECTION_GROUPS[0].id);});+ it('yields an empty section list for an unknown group instead of throwing', () => {+ expect(groupSections(undefined)).toEqual([]);+ expect(groupSections({ id: 'nope' })).toEqual([]);+ });+it('expands a group to its tab objects in declared order', () => {const sources = groupSections(SECTION_GROUPS.find((g) => g.id === 'sources'));expect(sources.map((t) => t.id)).toEqual(['documents', 'import', 'accounts', 'interview', 'autobiography', 'enrich']);diff --git a/client/src/components/digital-twin/constants.js b/client/src/components/digital-twin/constants.jsindex adf77ce5b1..56fef9973f 100644--- a/client/src/components/digital-twin/constants.js+++ b/client/src/components/digital-twin/constants.js@@ -80,11 +80,18 @@ export const SECTION_GROUPS = [{ id: 'legacy', label: 'Legacy', icon: Archive, sectionIds: ['export', 'legacy', 'time-capsule'] }];+// Resolved once at module load: both constants are static, so the nav never+// re-walks them per render.const TABS_BY_ID = new Map(TABS.map((t) => [t.id, t]));+const GROUP_SECTIONS = new Map(SECTION_GROUPS.map((g) => [+ g.id,+ g.sectionIds.map((id) => TABS_BY_ID.get(id)).filter(Boolean),+]));-// The group's sections as full tab objects, in group order.+// The group's sections as full tab objects, in group order. An unknown group+// yields an empty list rather than throwing.export function groupSections(group) {- return group.sectionIds.map((id) => TABS_BY_ID.get(id)).filter(Boolean);+ return GROUP_SECTIONS.get(group?.id) ?? [];}// Which group owns a section id. Falls back to the first group so an unknown or