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

ScopeProvider is not updating the value? #71

Open
michalsek opened this issue Jun 10, 2024 · 1 comment
Open

ScopeProvider is not updating the value? #71

michalsek opened this issue Jun 10, 2024 · 1 comment

Comments

@michalsek
Copy link

michalsek commented Jun 10, 2024

Not sure if it is a bug in bunshi or just it is how it is :)

Bug

ScopeProvider seems to not updating its value before nested component with a molecule tries to read it, f.e.

<ScopeProvider scope={SomeScope} value={condition ? 'meaningfullValue' : null}>
   {condition ? <UsesScopeMolecule /> : <NoScopes />
</ScopeProvider>

when the condition changes to true, <UsesScopeMolecule /> that requires the 'meaningfullValue' will receive null on first mount. Adding key that forces react to re-create the ScopeProvider on each value change seems to fix the problem.

Reproduction

https://stackblitz.com/edit/vitejs-vite-aouwed?file=src%2FApp.tsx

Bunshi version

Tested on 2.1.4 and 2.1.5

@gitivon
Copy link

gitivon commented Oct 31, 2024

I also encountered this problem and hope it can be resolved soon.

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

No branches or pull requests

2 participants