Repository navigation
perf(Icon): load the tooltip hover card only for icons that have one (3.0) - #374
Conversation
…(3.0) Icon imported HoverCard for its tooltip prop, so Animation and floating-ui came with Button, IconButton and every component that draws an icon. The hover card is now a lazy chunk; Button drops from about 33 to 22 kB gzip. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016gNJtxgzMmxuD2qeRfRW1z
The 300 ms timer read the global window when it fired. In CI it fired after sortable.test.tsx's jsdom was torn down and threw 'window is not defined' as an unhandled error, failing the run. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016gNJtxgzMmxuD2qeRfRW1z
|
"Build, typecheck and test" failed on 16aed7b. All 3905 tests passed, but Vitest caught an unhandled This PR doesn't touch that code, but the cause is real, so I fixed it in this PR: the cleanup now holds the window it was registered on. Browser behavior doesn't change. Locally, sortable.test passes on repeated runs. I couldn't reproduce the ordering here, so the next CI run is the check. Generated by Claude Code |
|
The "Docs build" failure on a89e6d8 (React #418 on Generated by Claude Code |
…fix/icon-data-split
…chunks Bundled without splitting, esbuild inlines each import() into the entry, so the gate counted Icon's lazy tooltip card in every component that draws an icon. With splitting, an entry costs itself and the chunks it imports statically. Re-recorded on the 3.0 branch with #374 in it: Button 35.3 -> 24.1 KB, Icon 31.3 -> 19.8 KB, ./code 49.0 -> 25.0 KB. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YJHdG7ZbpQS64MtL5PVbT1
* ci(core): bundle-size gate for every export entry scripts/bundle-size.mjs bundles each JS entry in core's exports (98 of them, the per-component subpaths included) the way an app would: minified, peers external, CSS modules counted. It also measures the two stylesheets, gzipped. Sizes are compared with bundle-size.json, and the step fails when an entry grows by more than 5% and 512 B. Record an intended growth with --update. It runs as a step in the existing build job and takes a few seconds. esbuild 0.27.7 is already in the lockfile. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YJHdG7ZbpQS64MtL5PVbT1 * fix(bundle-size): measure what an entry loads up front, not its lazy chunks Bundled without splitting, esbuild inlines each import() into the entry, so the gate counted Icon's lazy tooltip card in every component that draws an icon. With splitting, an entry costs itself and the chunks it imports statically. Re-recorded on the 3.0 branch with #374 in it: Button 35.3 -> 24.1 KB, Icon 31.3 -> 19.8 KB, ./code 49.0 -> 25.0 KB. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YJHdG7ZbpQS64MtL5PVbT1 --------- Co-authored-by: Claude <[email protected]>
Part of the bundle-size work from #359 and the Lighthouse audit, following #358.
Why
./components/Buttonmeasured 34.5 kB gzip in the new size gate. About a third of that came from Icon importingHoverCardfor itstooltipprop. That pulled in Animation, CursorFollower, HoverCover and floating-ui with every component that draws an icon.Change
IconTooltip.tsx, loaded withReact.lazyand shown inside<Suspense fallback={icon}>.IconTooltipis not in the root barrel, so it does not become a public subpath.Measured
I bundled
src/components/Button.tsxwith esbuild (minify, code splitting, React external):The rest is mostly the built-in icon data, about 10.9 kB gzip. Icons are looked up by name at runtime, so that data can't be split without changing the API. A more compact data format only saved 0.3 kB.
Checks
vitest run: 3903 passed, plus the newicon-tooltip-split.test.tsx.tsc --noEmitis clean.Generated by Claude Code