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

[v2] new API and new implementation with useMutableSource #12

Closed
wants to merge 90 commits into from
Closed

Conversation

dai-shi
Copy link
Owner

@dai-shi dai-shi commented Feb 20, 2020

  • new API: useContext(context, selector)
  • new implementation with useMutableSource in the RFC
  • in TypeScript

Check list:

  • implementation
  • readme

@dai-shi
Copy link
Owner Author

dai-shi commented Feb 21, 2020

Just did a quick benchmark. This is very simplified usage, and it may not reflect real use cases. react-redux-use-context-selector-2-keyed represents ff52b56 with useMutableSource-enabled (wip) React. (while others use React 16.8.6, so they are totally incomparable.)

image

@dai-shi
Copy link
Owner Author

dai-shi commented Feb 21, 2020

Here's another trial. both v1 and v2 use facebook/react@b028a0b.

image

@dai-shi
Copy link
Owner Author

dai-shi commented Feb 23, 2020

If we still need to use calculateChangedBits, we should stick with v1 without useMutableSource. That's very unfortunate though.

@dai-shi
Copy link
Owner Author

dai-shi commented Aug 3, 2020

@dai-shi
Copy link
Owner Author

dai-shi commented Sep 29, 2020

@dai-shi
Copy link
Owner Author

dai-shi commented Sep 4, 2021

uMS will not land, and v1.3 already works well with concurrent rendering at its best. Closing.

@dai-shi dai-shi closed this Sep 4, 2021
@dai-shi dai-shi deleted the v2 branch September 18, 2022 03:12
@HansBrende
Copy link

@dai-shi the replacement for useMutableSource is useSyncExternalStore.... why not use that function instead?

@dai-shi
Copy link
Owner Author

dai-shi commented Dec 15, 2022

It doesn't work as we want. It's "Sync" and its behavior isn't well in concurrent rendering.

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

Successfully merging this pull request may close these issues.

5 participants