SolidJSS
SolidJS16mo ago
26 replies
Tom

Context lost on HMR

I'm having an issue with the state of a Solid context getting lost on HMR.

This makes sense because the module that calls createContext is being reloaded, and the call is a module level statement, which is pretty normal I think.

But from this https://github.com/solidjs/solid-refresh/issues/15 it looks like solid-refresh should know how to preserve the state.

Is there some good practive that I'm missing to make this work?
GitHub
It seems during HMR any useContext() becomes undefined, potentially breaking components that trust on a context being always unavailable or set up without defaults, which in turn breaks the hot rel...
Contexts become undefined during HMR · Issue #15 · solidjs/solid-re...
Was this page helpful?