pmndrs / swc-jotai

MIT License
90 stars 14 forks source link

State resets upon fast-refreshing #14

Closed Adam13531 closed 1 year ago

Adam13531 commented 1 year ago

Update

I'm nearly positive that this isn't actually a bug; I was just on autopilot and never modified my next.config.js to contain swcPlugins as the README specifies, so of course I'm experiencing the behavior that I described below. 🤦‍♂️ I'm filing this issue only to immediately close it in case anyone else is like me and:

(the sliver of doubt about whether this is a bug is because I'm hitting #6 and #13, both of which are caused by this unresolved issue)

The "issue"

This is very similar to this issue in the Jotai repo, but with @swc-jotai/react-refresh instead of the "regular" react-refresh.

Minimal repro:

Repro video:

https://github.com/pmndrs/swc-jotai/assets/7192897/c3cac96a-3109-4e8e-bd49-b5823d89720e

Expected outcome: the counter's value remains > 0. Actual outcome: the counter resets to 0.

Adam13531 commented 1 year ago

(closing for reasons mentioned in the original post)