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

[Bug]: Uncaught error was not captured by the uncaught error function part of create root. #6868

Closed
CarreraPHP opened this issue May 15, 2024 · 1 comment

Comments

@CarreraPHP
Copy link
Contributor

Summary

Screenshot 2024-05-12 at 8 20 07 PM

Above error is because of react 17 react-dom.render method and it was not caught by the methods we added while creating root.

Page

https://react.dev/blog/2024/04/25/react-19#error-handling

Details

Below is the code that i have written in simple Vite app with react & react-dom version as 19.x

Screenshot 2024-05-12 at 8 20 37 PM

Below error is because of react 17 react-dom.render method and it was not caught by the methods we added while creating root.

Screenshot 2024-05-12 at 8 20 07 PM

While the vscode says it's a deprecated method but using it throws an uncaught error which is not caught by the newly introduced method. I believe some kind of message should be provided that createRoot/hydrateRoot methods are only methods to be used.

Screenshot 2024-05-12 at 8 16 13 PM

Screenshot 2024-05-12 at 9 50 58 PM

If someone is going to migrate to react 19 for its new features, easiness and the compiler. they can try to migrate directly from v15 - v18 to v19. this uncaught error could make things difficult for them.

Screenshot 2024-05-12 at 8 20 07 PM

@eps1lon
Copy link
Collaborator

eps1lon commented May 20, 2024

onUncaughtError applies only to errors that could have been handled by an Error Boundary. Calling ReactDOM.render could not have been caught by an Error Boundary since the root with the error handlers wasn't even created yet.

@eps1lon eps1lon closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants