Closed cbs-l closed 11 months ago
An interesting behavior is that the components that call useContext()
receive an undefined context once, but then they re-render with the proper context. In the following example, I had three components that use the context (and log it to the console). Upon changing the source code once, they rendered twice as follows:
This is the same issue as https://github.com/solidjs/solid-refresh/issues/15
This issue appears to be fixed. Please create a new issue if you encounter it again.
Describe the bug
When wrapping a context provider in another component with a store there is an issue where the following error would be thrown in the console.
If you make changes to nested or the app file HMR works correctly. However wrapping the Context Provider seems to create some issue with HMR.
You can unwrap the Counter Provider and then HMR seems to work fine. Only when wrapping does this seem to be an issue.
To reproduce use the code from the following on your local machine and just run dev and make changes to the counter file after you have loaded the page beforehand:
https://www.solidjs.com/tutorial/stores_context?solved
Your Example Website or App
https://www.solidjs.com/tutorial/stores_context?solved
Steps to Reproduce the Bug or Issue
Expected behavior
As the user I would expect this to either load up the initial state or previous.
Screenshots or Videos
No response
Platform
Additional context
No response