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

[Bug]: React Context Provider in Global Decorator not working in monorepo #29144

Open
saiichihashimoto opened this issue Sep 17, 2024 · 0 comments

Comments

@saiichihashimoto
Copy link
Contributor

Describe the bug

In a monorepo where storybook is one of the packages (ie packages/storybook) rending stories from another package (ie packages/components), any imported react providers put into a decorator in preview don't actually provide the value, but if I use the provider at the story level (which is colocated with the component in packages/components), it works.

Reproduction link

http://localhost:6006/?path=/story/components-level--area-1-level-1&globals=backgrounds.value:transparent;backgrounds.grid:!true

Reproduction steps

  1. Go the above link.
  2. Dragging the green block between the sun and the flower should make a sound, but it doesn't (global provider is loading sounds).
  3. Go to Solvers/BreadthFirstSearch/Area1Level2
  4. Immediately you'll hear a sound, and if you drag a block away and back, you'll hear the sound (uses a story level provider).

System

Chromatic

Additional context

I THINK it's because storybook is using built code when I import the providers into preview, but is using the story's components directly when it find a story in that package, making them TECHNICALLY different react contexts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant