Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition when stories and their components are updated out of order #1395

Open
fwouts opened this issue Mar 3, 2023 · 0 comments
Open

Comments

@fwouts
Copy link
Owner

fwouts commented Mar 3, 2023

Due to how components are cached across detection refreshes (https://github.com/fwouts/previewjs/blob/main/core/src/detect-components.ts), there is a particular edge case where stories will never be detected:

  • src/Component.stories.js is created with stories referencing component A from src/Component.tsx
  • src/Component.tsx doesn't exist yet (or it does, but A isn't exported yet)
  • Preview.js loads and detects components, but stories aren't detected because the associated component cannot be found
  • src/Component.tsx is updated and A is now exported
  • Preview.js correctly refreshes and detects A but since src/Component.stories.js hasn't been touched, its stories aren't re-detected (even though they would now be)
@fwouts fwouts added this to Preview.js Mar 3, 2023
@fwouts fwouts converted this from a draft issue Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

1 participant