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
Not sure if it is a bug in bunshi or just it is how it is :)
Bug
ScopeProviderseems to not updating its value before nested component with a molecule tries to read it, f.e.when the condition changes to true,
<UsesScopeMolecule />that requires the 'meaningfullValue' will receivenullon first mount. Adding key that forces react to re-create theScopeProvideron 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