fix(ui): keep the icon gallery renderable when icons.tsx exports a non-component - #2559
fix(ui): keep the icon gallery renderable when icons.tsx exports a non-component#2559ARE404 wants to merge 1 commit into
Conversation
…n-component `icons.tsx` is not only components: apache#2538 added `ICON_SIZE`, the sizing ladder call sites read. The gallery enumerates the module and mounts whatever comes back, so that object was rendered as an element — React rejects it outright ("element type is invalid", error apache#130) and the whole story goes down with it, which fails the Storybook smoke run. The enumeration is the point and stays: a hand-kept list is what would let a newly added icon go unrendered. Filter on what can actually be mounted instead. Lucide's icons arrive as `forwardRef` objects rather than plain functions, so the test is React's own element-type marker rather than `typeof value === 'function'`. Verified with `build-storybook` + `smoke:storybook`: the run passes end to end (48 manifest checks, 101 catalog renders) where it previously failed on this one story.
|
Heads-up on this PR's own That is a second, independent breakage sitting behind the same path gate, and this branch is a single file ( Worth knowing before someone tries to reproduce it: it passes on macOS and fails on Linux CI. My local The assertion at I have not touched it here. Happy to take it in a third PR if you want it from me. |
|
Superseded by #2544 — same bug, same shape of fix, already on main. Closing this rather than rebasing it. For anyone reading back: yours filters on The second failure I noted above — |
What
Design System/Iconscurrently throws on mount, which fails the Storybook smoke run.The gallery enumerates
icons.tsxand mounts every export:That held while the module was only components. #2538 added
ICON_SIZE— the sizing ladder (meta/control/chrome/empty/plate) call sites read — so the story now mounts a plain object as an element. React rejects it outright:Enumerated at runtime, it is the only one: 112 exports, 1 non-component.
The fix
Keep the enumeration and filter on what can actually be mounted. The enumeration is deliberate — the story's own comment on
BOT_BRAND_PROVIDERSmakes the argument, and it applies here too: a hand-kept list is satisfied by any subset, so a newly added icon would silently never render.Lucide's icons arrive as
forwardRefobjects rather than plain functions, so the test is React's own element-type marker, nottypeof value === 'function'.Why CI did not catch it
The
storybookjob is path-gated (needs.changes.outputs.storybook == 'true'). On the runs where it mattered it wasskipped, so main is green with this story broken — I hit it from a branch that does trip the gate.Verification
npm --workspace @maka/desktop run build-storybook && npm --workspace @maka/desktop run smoke:storybook✗ design-system-icons--lucide-icons→1 story check(s) failed, exit 1✓ design-system-icons--lucide-icons→Product Storybook smoke passed (48 manifest check(s), 101 catalog render(s)), exit 0Split out of #1874 rather than folded into it — it is unrelated to that feature and shouldn't need its review.