Skip to content

[v8] Prototype: Investigate migrating to useMutableSource #1762

Closed

Description

Background: #1740

Now that we have the TypeScript port mostly complete, we can at least start thinking about React 18 compatibility changes.

Most likely we will want to convert our current subscription and change detection logic to use the new React useMutableSource hook instead.

As of react@18.0.0-alpha-241485a2c-20210708, useMutableSource does appear to be in the current React alpha versions.

I'd like to see some experimental PRs filed that try to switch over to useMutableSource, so we can at least see what sort of changes are needed, and begin to get a sense of what this means for performance. Any PRs should be done against the typescript-port branch as a starting point - we'll hopefully be merging that into master in the near future.

We should probably start with useSelector first, as that's simpler. After that we can look at updating connect as well.

For details on useMutableSource and how it works, see the RFC and PR that added it, as well as some of the discussions on things like "tearing" in the React 18 Working Group:

There are a few examples of using it, including a couple examples by Daishi Kato of doing Redux subscriptions. Some examples that I've found:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions