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

React 19 support #1883

Open
osdiab opened this issue Oct 29, 2024 · 7 comments
Open

React 19 support #1883

osdiab opened this issue Oct 29, 2024 · 7 comments

Comments

@osdiab
Copy link

osdiab commented Oct 29, 2024

It looks like the peer dependencies of Visx do not include React 19, but NextJS 15 was released as stable and it depends on React 19. Would be great to know if visx is tested against it. Thanks!

@nevnein
Copy link

nevnein commented Nov 2, 2024

I am migrating a project to React 19, right now everything visx-related kinda works already, the only problem I've found is in useTooltipInPortal causing an Uncaught Error: Switched to client rendering because the server rendering errored: window is not defined. Probably the trick used here to check for SSR is not valid anymore. EDIT: Or maybe the initial state should be true?

@V-iktor
Copy link

V-iktor commented Nov 13, 2024

I was getting the following after upgrading

Cannot find module '@visx/vendor/d3-array' or its corresponding type declarations.ts(2307)

Never had it in my package.json but adding it manually seems to have solved it and I am not getting any errors

pnpm i @visx/vendor

@darthmaim
Copy link
Contributor

React 19 is now stable.

The only issue I've encountered so far would be fixed by #1837.

@williaster
Copy link
Collaborator

Thanks everyone - we weren't sure exactly how to handle this when Next upgraded to React 19, before it was stable.

We'll try and get on this now that it's stable, thanks for the investigation and PR @darthmaim 🙏 👀

@darthmaim
Copy link
Contributor

darthmaim commented Dec 6, 2024

I've tried to create a PR to update all peerDependencies to include react@19, but all test fail for various reasons:

  • it seems that enzyme can't render using react 19 at all (it already doesn't really support react@18 and react@17).
  • react@19 uses queueMicrotask which is not supported by the 5 year old version of jest used in this project
  • upgrading jest fails because of outdated babel
  • and so on...

The best way forward is probably to include react@19 in the peer dependencies, but still run all tests in this repo using react@18. Release this is as a prerelease, so it can be "integration tested" by others.

I've created a PR for this:

Then slowly work on upgrading all dependencies (which might include rewriting all tests using @testing-library/react instead of enzyme) to be able to run tests using react@19.

I've started some of those PRs here already:

@williaster
Copy link
Collaborator

Thanks @darthmaim !

Will try to get eyes on these asap, agree with your proposed order of events. Will see if I can get the alpha branch out today. Have been discussing expanding some internal LLM scripts to help us migrate the enzyme tests to RTL, may spill into next year but hoping they can do the heavy lifting 💪

@williaster
Copy link
Collaborator

fyi we got the pre-release out as 3.13.0-alpha.0, let me know if you see any issues. working through a bunch of other items to get the project itself on react@19 with great help from @darthmaim !

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

No branches or pull requests

7 participants
@osdiab @darthmaim @williaster @nevnein @V-iktor and others