react-spectrum
0a49c832 - fix(sb10): patch preview-api lazy getters to use deferred init; restore FEATURES.highlight

Commit
108 days ago
fix(sb10): patch preview-api lazy getters to use deferred init; restore FEATURES.highlight Root-cause fix replacing the previous symptom-workaround. Storybook's dist/csf/index.js has a circular dependency with dist/_browser-chunks/chunk-SZQXB3JV.js and dist/preview-api/index.js. When Parcel's CJS bundler initialises these modules, csf/index.js runs its highlight-addon preview.ts code (line 916) before the storybook/preview-api module's 'addons' export is fully resolved. The resulting getter access throws TypeError during the circular-dep init window. The fix defers the highlight initialisation one microtask tick using Promise.resolve().then(), wrapped in try/catch for belt-and-braces safety. By the time the callback fires all circular deps are resolved and 'addons' holds the live AddonStore instance. Highlights initialise correctly. Patch is applied via patch-package (already in postinstall). Restores FEATURES.highlight to its default true, preserving accessibility- violation visualisation that addon-a11y depends on. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
Parents
Loading