Calhistorian
Placement of Context Providers and Routes (Router 10.10)
I don't know if this helps, but for completeness for the thread and others down the line. I can't figure out why one provider works and the others do. Each provider plays a very small role -- settings, UI state, user, and some core shared data. 🤷♂️
8 replies
Placement of Context Providers and Routes (Router 10.10)
Interesting, I was just running some tests after doings some refactoring by fetching the provider data in its own component that wraps the <MainWindow> component.
app.tsx
So it seems all the context providers are working except one. The logged output in the console is:
Each context is constructed in the exact same way using a Solid Store at its core:
8 replies
Placement of Context Providers and Routes (Router 10.10)
Thank you for the suggestion.
No. Definitely not. Out of habit, I never destructure props.
I know there is a lot of unknowns in the post itself, but my main concern is whether its ok to have the providers wrapping the router. The context providers are where I put the Electron IPC renderer handles and cache data from the main process. I thought perhaps maybe some race condition is an issue, but the evidence just isn't there that I can see. It is a data heavy application which is why I am concerned about having the context providers above the router.
8 replies
Placement of Context Providers and Routes (Router 10.10)
I am unable to access provider data in
<Nav>
or in route children.
However, if I wrap the <HashRouter>
in the providers it works just fine. Alternatively, I have added another component within <AppWindow>
and fetched the context data in that component, but that doesn't work either.
Is it ok to leave the providers above the <Router>
? Or am I missing something?8 replies