Skip to content

fix(shared): break barrel self-import cycle crashing /crown-jewels - #227

Merged
0xmanhnv merged 1 commit into
developfrom
fix/shared-barrel-circular-import
Jul 8, 2026
Merged

fix(shared): break barrel self-import cycle crashing /crown-jewels#227
0xmanhnv merged 1 commit into
developfrom
fix/shared-barrel-circular-import

Conversation

@0xmanhnv

@0xmanhnv 0xmanhnv commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

/crown-jewels crash: 'Element type is invalid … got: undefined' in a table cell

Root cause: src/features/shared/components/coming-soon-page.tsx is itself part of the @/features/shared barrel, yet it imported PageHeader from @/features/shared — a circular dependency through the barrel. Under Turbopack this can leave some barrel exports (e.g. RiskScoreBadge, used in the crown-jewels risk-score cell) undefined at module-init depending on evaluation order → React throws Element type is invalid … got: undefined from the cell renderer.

Fix: import PageHeader directly from ./page-header, breaking the cycle. Verified no other shared component self-imports the barrel; tsc clean.

This is a latent barrel anti-pattern (a barrel member importing its own barrel) — the fix is correct regardless of which page happened to surface it.

…crown-jewels)

coming-soon-page.tsx is part of the @/features/shared barrel yet imported
PageHeader FROM '@/features/shared' — a circular dependency through the barrel.
Under Turbopack that leaves some barrel exports (e.g. RiskScoreBadge) undefined
at module-init depending on load order, which crashed the crown-jewels table
cell with 'Element type is invalid ... got: undefined'.

Import PageHeader directly from './page-header' to break the cycle. No other
shared component self-imports the barrel.
@0xmanhnv
0xmanhnv merged commit 9ff63bc into develop Jul 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant