ctrlplusb / easy-peasy

Vegetarian friendly state for React
https://easy-peasy.dev
MIT License
5.03k stars 190 forks source link

Making sure models created with useLocalStore stop updating the state on update #914

Closed yard closed 3 months ago

yard commented 4 months ago

As described in https://github.com/ctrlplusb/easy-peasy/issues/913, when a model created by useLocalStore is re-created due to dependency array change, it won't unsubscribe itself and will continue delivering state updates to (now new) model.

The test case added in this PR demonstrates exactly that (fails on current master, works in this branch).

vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
easy-peasy ❌ Failed (Inspect) Jul 9, 2024 1:24pm