statelyai / xstate

Actor-based state management & orchestration for complex app logic.
https://stately.ai/docs
MIT License
27.21k stars 1.26k forks source link

[@xstate/store] Fix `useSelector(…)` infinite loop #5080

Closed davidkpiano closed 2 months ago

davidkpiano commented 2 months ago

The useSelector(…) hook will no longer result in an infinite loop when an object-like value is returned from the selector function.

cc. @TkDodo - I had to bring back in useSyncExternalStoreWithSelector (copy-pasted, no dependencies), but if you have any better ideas for solving this, I'm open to a simpler solution.

changeset-bot[bot] commented 2 months ago

⚠️ No Changeset found

Latest commit: c917b1c10206d42ec61450d3067e18f22f459ba8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR