Omnistac / zedux

:zap: A Molecular State Engine for React
https://Omnistac.github.io/zedux/
MIT License
344 stars 7 forks source link

[Bug] `useAtomSelector` does not work in certain (unknown) circumstances #91

Closed crabvk closed 7 months ago

crabvk commented 7 months ago

Zedux Version

1.1.1

Description

I'm facing some strange useAtomSelector bug where in certain circumstances selector doesn't update when the selected value changes. If I replace selector with an ion which has the same getter then it works. Another workaround is to put forceUpdate (from useReducer) right after I update the global atom's state in my component.

Reproduction

Can't reproduce the issue in sandbox. The project I'm working on isn't open source, so there's no public repo. Is it possible to share code with you privately? If yes, please send me your email here or in Telegram (@crabvk).

bowheart commented 7 months ago

Hey @crabvk does version 1.2.0-rc.1 fix this for you? (Install via npm install @zedux/react@next or similar). This is the next release candidate that we're still testing, but looks stable. It fixed #83, another issue with selectors that may be related. We're currently expecting 1.2.0 to contain no changes beyond what's already released in 1.2.0-rc.1.

crabvk commented 7 months ago

Yes, it does 🚀 Thank you!