Controls: Load controls for stories from a composed ref#35050
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR fixes the rendering behavior of ChangesComposed Ref Preview Initialization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Sidnioulz
left a comment
There was a problem hiding this comment.
Good job, that wasn't an easy one! Fix looks good to me, story renders well. 👏
I'm waiting for CI to be done. I've also launched a canary release workflow. Once it's over, there will be a comment at the bottom of the PR with the canary package's version.
Either you or I should check on the reproduction repo if, using that canary version, the problem is fixed. Feel free to do it if you have time before I do, and let me know how it goes :)
Once we've verified in the original repro repository, we can merge!
|
Note to self: Introduces a regression, see issue comments. If not fixed by release date, revert PR. |
What I did
Fixes #34553 — controls never load for a story served from a composed Storybook ref (
refs/extends: true).ControlsPanelonly watched the host's globalpreviewInitializedflag, which staysfalsefor ref stories — their readiness is tracked per-ref instate.refs[refId].previewInitialized. SoisLoadingnever cleared and the args table showed loading skeletons forever.The fix reads the ref's
previewInitializedwhen the current story belongs to a ref, and falls back to the global flag otherwise.Manual testing
refsand open one of its stories — its Controls now load instead of showing skeletons.ControlsPanel.stories.tsx(RefStoryControlsLoad): it mocksManagerContextfor a ref story while the host's globalpreviewInitializedis stillfalse, and asserts the controls render. Verified it fails on the pre-fix behaviour and passes with the fix:Closes #34553
Summary by CodeRabbit
Bug Fixes
ControlsPanelto correctly determine preview initialization status for stories in composed refs, ensuring controls load properly when referencing stories from other Storybook instances (resolves issue#34553).Tests