-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
HMR confuses global signals #512
Comments
Might be related to #488?
|
This should be resolved by #524 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When using preact with vite, a conflict arises when multiple contexts are defined using the same variable name. Even if these contexts are created in separate files, if they are assigned to the same variable name, they seem to override each other. This only happens when running
npm run dev
, not when runningnpm run build
ornpm run preview
.To Reproduce
I created a minimal example exhibiting this behavior: https://github.com/rjvdw/preact-context-bug. Foo.jsx, Bar.jsx and Baz.jsx all define their own context. Foo.jsx and Bar.jsx use
const ctx = createContext
, whereas Baz.jsx usesconst ctxBaz = createContext
.Expected behavior
When running this app, you are presented with three buttons. I would expect each button to only increment the counter directly next to this button, but instead the counters for Foo.jsx and Bar.jsx are linked. I.e. when I increment Foo, Bar is also incremented and vice versa. The counter for Baz is working as intended.
The text was updated successfully, but these errors were encountered: