Closed flochtililoch closed 9 months ago
@flochtililoch the configure function gets called in the generated code inside storybook.requires.js and shouldn't be directly called in your code.
@dannyhw Interesting, I've had this code configured this way since our first install of storybook 6 years ago, I must have missed this during my latest migration, though I don't remember this being called out on the migration steps.
Is the intention for configure
to be called only once and by storybook.requires
only?
@flochtililoch yes it's intended because now we generate your imports and configure should never be called twice otherwise it would cause those weird behaviours. This will enable some cool changes in v7 too.
In the official blog for the release the first step does briefly mention removing the configure call but perhaps its not super clear https://storybook.js.org/blog/storybook-for-react-native-6-5/
Great, thanks for the insights! This was a bit of a pickle and I'm glad I'm now past this issue. I wonder if it would make sense to emit a warning when configure
is called more than once (as it was in my case), which could help future devs who are upgrading older projects.
Will close this issue for now.
Describe the bug When using the
configure
API that helps with initializing custom code before storybook starts, the stories written using CSF format don't render in the list of stories (on both Storybook web UI and mobile UI). Saving a file present in the bundle to trigger hot reload will cause the missing stories to appear on the Storybook web UI, but these will still be missing on the Storybook mobile UI. Commenting out the code that callsconfigure
will prevent the bug from happening. EDIT: stories usingstoryOf
don't have this problem and will render on the first load.To Reproduce See reproduction steps in this repo.
Expected behavior CSF stories should appear on Storybook UIs on first load.
Screenshots See demo here.
Code snippets
configure
API is called right beforeAppRegistry.registerComponent
. The first argument function does not need to execute anything to trigger the bug:System: