npm react-redux 8.0.0-beta.3

latest releases: 9.0.3, 9.0.2, 9.0.1...
22 months ago

This beta release fixes a regression with unsubscribe performance in useSelector, and does some minor internal cleanup in connect.

At this point, React-Redux v8 is likely feature-complete and stable. We still really want users to try this out and give us feedback before the final release! We'd also like to add some additional tests around SSR behavior.

The tentative plan is to do a final review of the code and behavior after React 18 goes final, then release React-Redux v8 final shortly after that.


useSelector Unsubscribe Performance

In 2019, we fixed a a reported issue with useSelector unsubscriptions showing quadratic performance, due to use of a single listeners array in our Subscription class. The fix was to switch to using a linked list to track subscribers.

When we reworked useSelector to use useSyncExternalStore for v8, we passed store.subscribe directly and stopped subscribing via a Subscription instance, thinking that we might no longer need Subscription any more. However, Subscription is still used by <Provider>, so it won't be removed from the bundle anyway, and the switch to using store.subscribe regressed the unsubscription performance because it does still use a listeners array as well.

We've switched back to having useSelector subscribe to the Subscription instance from <Provider>, and verified that this re-resolves the unsubscription performance behavior. We've also added a perf test to ensure that we capture this intended behavior and don't accidentally regress on this again in the future.

Internal Cleanup

We've removed a couple additional references to the removed pure option in connect, and tweaked some of the types to remove a legacy signature for Provider that is no longer relevant.

What's Changed

  • test: Adjust type tests to be compatible with React 18 typings by @eps1lon in #1868
  • Switch back to Subscription in useSelector to fix unsubscribe perf by @markerikson in #1870
  • Cleanup more code after pure removal by @Andarist in #1859

Full Changelog: v8.0.0-beta.2...v8.0.0-beta.3

Don't miss a new react-redux release

NewReleases is sending notifications on new releases.