S
SolidJS5mo ago
Grahf

no luck with context providers

~hello... I'm trying to use a context provider in a tauri app(maybe you're familiar with it?) and it's not working. The last time I tried to use a solidJS context provider was in a astroJS app. I seem to be getting the exact same behavior here IIRC. It gets the initial values from the createContext and that's it... I can't seem to get the signals in the provider to update. I made a stack blitz that's very similar to what I'm trying to do and it works fine. Not sure why it doesn't work in my app. https://stackblitz.com/edit/solid-app-gn3dpd?file=src%2Findex.jsx,src%2FApp.jsx,src%2FProvider.jsx,src%2FHelloWorld.jsx
StackBlitz
Solidjs App (forked) - StackBlitz
Vite + solid templates
6 Replies
Grahf
Grahf5mo ago
When I say I only get the initial value of the provider I mean where it says 'Not Installed' in Provider.jsx. That's all I can get from the provider.
REEEEE
REEEEE5mo ago
Seems to be working in the stackblitz that you provided
Grahf
Grahf5mo ago
yep it works fine there.... but in a tauri app I can only get the value "Not Installed" from the provider - it never updates I think it's related to router becuas in the sandbox im not using router but in my actual project I am using router Is this the right way to wrap the components in the provider? render( () => ( <Router> <GameVersionProvider> <Route path='/' component={BaseLayout}> <Route path='/' component={Home} /> <Route path='/about' component={About} /> <Route path='/support' component={Support} /> <Route path='/rules' component={Rules} /> <Route path='/links' component={Links} /> <Route path='/account' component={Account} /> <Route path='/auth' component={Auth} /> <Route path='/tools/crafting' component={Recipes} /> <Route path='/tools/adventurers' component={Adventurers} /> <Route path='/adventurer-details' component={AdventurerDetails} /> <Route path='/player' component={Player} /> <Route path='/create-adventurer' component={CreateAdventurer} /> <Route path='*404' component={NotFound} /> </Route> </GameVersionProvider> </Router> ), document.getElementById('root'), it is not correct
REEEEE
REEEEE5mo ago
Maybe try wrapping the router itself
Grahf
Grahf5mo ago
I wrapped a common ancestor component in the provider and it works Specifically I wrapped everything return by the BaseLayout component
REEEEE
REEEEE5mo ago
Yeah makes sense i guess since the Route components aren't actual elements