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

WIP: Support React 18 #93

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

WIP: Support React 18 #93

wants to merge 2 commits into from

Conversation

albertogasparin
Copy link
Collaborator

This is still a WIP branch, but the library now works properly with React 18, both in createRoot and hydrateRoot modes, and StrictMode too.
I had to refactor some of the logic to not leverage anymore on the placeholders re-rendering, as if that happens R18 hydration process bails out and goes back to fallback (related issue ).

This actually poses an interesting dilemma, as our controlled phases are in reality discouraged by React team itself, as they poses risk of broken hydration if context data (for instance) changes before hydration occurs.
So I think it might be beneficial to resume the work on #73 and migrate to that so we shorten the time for afterPaint to click in.

Anyway, I'm planning to backport some of the changes (for instance StrictMode support, examples, subscriptions refactor, ...) to the current branch so the diff here will become much smaller and manageable.

Lastly, I'ver dropped from this branch support for React 17 and lower. We could to either publish this as v2 (only R18+ compatible) or keep the old code in branches by detecting older versions of React. What do you think?

Todo:

  • Update tests
  • Backport StrictMode compliance to master
  • Decide if we want backward compat

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