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

React18 support #3387

Merged
merged 12 commits into from
May 6, 2022
Merged

React18 support #3387

merged 12 commits into from
May 6, 2022

Conversation

mweststrate
Copy link
Member

@mweststrate mweststrate commented May 3, 2022

This pull adds experimental / poor man's support for React 18. Fixes #3363, #2526. Supersedes #3005

  • Updated tests, test / build infra, peerDependencies to React 18
  • [breaking icmw upgrading to React 18] Already deprecated hooks like useMutableSource will trigger warnings in React 18, which is correct and those shouldn't be used anymore.
  • [breaking icmw upgrading to React 18] When using React 18, it is important that act is used in unit tests around every programmatic mutation. Without it, changes won't propagate!
  • The React 18 support is poor-mans support; that is, we don't do anything yet to play nicely with suspense features. Although e.g. startTransition basically works, MobX as is doesn't respect the suspense model and will always reflect the latest state that is being rendered with, so tearing might occur. I think this is in theoretically addressable by using useSyncExternalStore and capturing the current values with together with the dependency tree of every component instance. However that isn't included in this pull request 1) it would be a breaking change, whereas the current change is still compatible with React 16 and 17. 2) I want to collect use cases where the tearing leads to problems first to build a better problem understanding. If you run into the problem, please submit an issue describing your scenario, and a PR with a unit tests demonstrating the problem in simplified form. For further discussion see Support concurrent features React / React 18 #2526, [WIP] Support React 18 #3005

@changeset-bot
Copy link

changeset-bot bot commented May 3, 2022

🦋 Changeset detected

Latest commit: a6066dd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
mobx-react Minor
mobx-react-lite Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ColtHands
Copy link

what more needs to be done to approve this?

@mweststrate
Copy link
Member Author

Writing a good changelog what is and is not addressed. Hope to get to that tomorrow😅

@mweststrate mweststrate mentioned this pull request May 4, 2022
14 tasks
@mweststrate mweststrate marked this pull request as ready for review May 5, 2022 08:05
@mweststrate mweststrate changed the title React18 2 React18 support May 5, 2022
@iChenLei iChenLei requested a review from kubk May 5, 2022 08:33
Co-authored-by: Veniamin Krol <153412+vkrol@users.noreply.github.com>
@mweststrate mweststrate merged commit bd4b70d into main May 6, 2022
@github-actions github-actions bot mentioned this pull request May 6, 2022
@akphi
Copy link

akphi commented May 7, 2022

@mweststrate sorry, what does icmw mean?

@mweststrate
Copy link
Member Author

mweststrate commented May 7, 2022 via email

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.

Install mobx-react peer dependency error on react v18.0.0
5 participants