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

support concurrent mode without triggering force update in provider #42

Merged
merged 4 commits into from
Mar 7, 2020

Conversation

dai-shi
Copy link
Owner

@dai-shi dai-shi commented Mar 6, 2020

This is a new implementation with useReducer chat mode.

In the previous version, we triggered re-render in render in the provider component to support CM.
But, it gives us "Cannot update a component from inside the function body of a different component." warning. This is really hard one (related issue), because we rely on calculateChangedBit = 0 + subscription hack.

This version should work like useSubscription, and it will pass check 1-8 in https://github.com/dai-shi/will-this-react-global-state-work-in-concurrent-mode

This would affect to the performance, unfortunately. We will wait for useMutableSource for better implementation.

@dai-shi
Copy link
Owner Author

dai-shi commented Mar 7, 2020

Hm, this implementation is somewhat similar to what I did in react-redux as an experiment. reduxjs/react-redux#1509
This still uses useRef, but we probably need it anyway with useTrackedState.

@dai-shi
Copy link
Owner Author

dai-shi commented Mar 7, 2020

Okay, it looks like working. Good to go.

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.

1 participant