Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v8] Prototype: Investigate migrating to useMutableSource #1762

Closed
markerikson opened this issue Jul 9, 2021 · 2 comments
Closed

[v8] Prototype: Investigate migrating to useMutableSource #1762

markerikson opened this issue Jul 9, 2021 · 2 comments

Comments

@markerikson
Copy link
Contributor

markerikson commented Jul 9, 2021

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:

@wurstbonbon
Copy link
Contributor

Here is a little experiment to get things started #1792

@markerikson
Copy link
Contributor Author

Superseded by useSyncExternalStore, and accomplished in #1808 .

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

No branches or pull requests

2 participants