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

docs: adds more helpful text for hydration errors (closes #3267) #3275

Merged
merged 3 commits into from
Nov 22, 2024

Conversation

gbj
Copy link
Collaborator

@gbj gbj commented Nov 22, 2024

Error messages in the case of hydration problems are currently very unhelpful in 0.7, as I had not yet done anything to make them more useful. For example, if the renderer was expected to find an element and found something else instead, you just got an .unwrap() inside HtmlElement::hydrate().

This adds some debugging machinery that attempts to do the following:

  1. Provide a useful error message.
  2. List the location of the view! or element that is currently being hydrated, to help narrow down problems.
  3. Logs out the unexpected node as part of the error message in the JS console. Most browser devtools allow you to right-click and go to where that node is used in the page, which means you can navigate directly to wherever in your application the unexpected node was found.

@gbj gbj merged commit 3de0414 into main Nov 22, 2024
74 checks passed
@gbj gbj deleted the better-hydration-errors branch November 22, 2024 20:10
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