Closed jvatic closed 1 year ago
Thanks for the report @jvatic. What is the expected outcome in this case? No refresh support for these scenarios? I don't think we can capture these factory scenarios.
@Thisen Yeah, no refresh support for these scenarios sounds reasonable. For my use case there are still a number of atoms using the regular flow where having refresh would be useful. (Ideally factory scenarios could be supported too, but I totally get that being out of scope.)
Should be fixed with @swc-jotai/react-refresh@0.0.4
.
When the
@swc-jotai/react-refresh
plugin is enabled, atoms created using a factory function have their values confused (i.e. given two atoms with different initial values, both of them will have the same value). Disabling the plugin returns the atoms to the correct behavior.See https://github.com/jvatic/pmndrs-swc-jotai-issue-4 for a minimal repro.