[6.x] Avoid per-icon requests in the Icon storybook#14580
Merged
jasonvarga merged 1 commit into6.xfrom Apr 30, 2026
Merged
Conversation
The AllIcons story renders 537+ icons; with the lazy glob each one fired its own request, tripping Cloudflare's abuse protection and 403'ing most of them. Eagerly load and re-register the default set as strings so the Storybook bundle inlines the SVGs. The CP keeps its lazy glob.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
AllIconsstory inIcon.stories.tsrenders all 537+ icons in the default set. Because the default set is registered with a lazyimport.meta.glob(inresources/js/components/ui/Icon/registry.js), each icon triggers its own dynamic import. Cloudflare's abuse protection then 403s most of them, leaving the docs page broken.This PR overrides the default set inside
Icon.stories.tswith an eager glob ({ eager: true, query: '?raw', import: 'default' }) and re-registers it viaregisterIconSetFromStrings, so the Icon component takes the string-loading path and never makes HTTP requests for SVGs.The change is scoped to the Storybook bundle —
Icon.stories.tsis not part of the Control Panel entry, so the CP continues to lazy-load icons as before.Test plan
npm run storybookand open Components / Icon / Available Icons.