Skip to content

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

Closed
dai-shi wants to merge 90 commits into
masterfrom
v2
Closed

[v2] new API and new implementation with useMutableSource#12
dai-shi wants to merge 90 commits into
masterfrom
v2

Conversation

@dai-shi

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

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

Check list:

  • implementation
  • readme

@dai-shi

dai-shi commented Feb 21, 2020

Copy link
Copy Markdown
Owner Author

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

dai-shi commented Feb 21, 2020

Copy link
Copy Markdown
Owner Author

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

image

@dai-shi

dai-shi commented Feb 23, 2020

Copy link
Copy Markdown
Owner Author

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

@dai-shi

dai-shi commented Aug 3, 2020

Copy link
Copy Markdown
Owner Author

@dai-shi

dai-shi commented Sep 29, 2020

Copy link
Copy Markdown
Owner Author

@dai-shi

dai-shi commented Sep 4, 2021

Copy link
Copy Markdown
Owner Author

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
Copy Markdown

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

@dai-shi

dai-shi commented Dec 15, 2022

Copy link
Copy Markdown
Owner Author

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