-
Notifications
You must be signed in to change notification settings - Fork 57
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
Store properties undefined on "first render" #14
Comments
That 's kinda expected, because stockroom initializes the store asynchronous from within the webworker, the state won't be available on first render. Maybe it would be worth to add a initialized property to the store and maybe a component that only renders it 's children after the store received the initial state. What do you think @developit ? |
That would work, though it's not possible to skip initial renders in vdom sadly. Another option might be to allow passing |
you could skip first render in a mechanic that you apstract your index... Think about your normal app is in index.jsx now you add a entry.jsx and link you bundle to entry.jsx instead, export your Store from index.jsx. now inside of entry.jsx
...but this also require that you have some auto warmup action inside of your worker that set a state like warmupDone.... but this will delay your render in my example about 300 ms but it doesn't metter because i use a prerender engine built on top of preact-render-to-string in the background but you have to think about something like that otherwise this will delay first meaning full render |
For a reason that I do not know, my store is undefined on "first render".
In that capture of devtools console, I log a property of my store.
It is first
undefined
then HMR comes and then the property isdefined
.I don't have that problem when I only use unistore without stockroom.
The text was updated successfully, but these errors were encountered: