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

Error: In HTML, <pre> cannot be a descendant of <p>. This will cause a hydration error. #770

Open
LeyoNeuroAI opened this issue Feb 6, 2025 · 10 comments · May be fixed by #832
Open

Error: In HTML, <pre> cannot be a descendant of <p>. This will cause a hydration error. #770

LeyoNeuroAI opened this issue Feb 6, 2025 · 10 comments · May be fixed by #832

Comments

@LeyoNeuroAI
Copy link

Keeping getthing error on Code tool calling for Dijstra, I am using the Claude Model and dont know if its an issue with that

Error: In HTML,

 cannot be a descendant of 

.
This will cause a hydration error.

Complete error at https://pastebin.com/mbN1SVi3 since could not format it correctly

@Asin-Junior-Honore
Copy link

Asin-Junior-Honore commented Feb 10, 2025

Hey @LeyoNeuroAI,

The error "In HTML, <pre> cannot be a descendant of <p>" is a React hydration error caused by invalid HTML nesting.

Why is this happening?

  • <pre> (used for preformatted text) cannot be inside a <p> (paragraph) tag.
  • Your Markdown rendering component (<Markdown>) is likely converting code blocks (<pre> inside <code>) inside a <p>, which creates an invalid structure.

That is my suggestion and analysis after viewing the whole content in the Pastebin-Link you provided.

Suggested Fix:

To prevent <pre> from being wrapped inside <p>, you can customize the Markdown renderer to handle code blocks properly.

Hope this helps a little bit.

@LeyoNeuroAI
Copy link
Author

@Asin-Junior-Honore shouldnt this be done in the main branch then to avoid others form having an issue

@jakin6
Copy link

jakin6 commented Feb 10, 2025 via email

@Asin-Junior-Honore
Copy link

@Asin-Junior-Honore shouldnt this be done in the main branch then to avoid others form having an issue

Well, @LeyoNeuroAI, I would suggest creating a separate branch for this, then raising a PR before merging it into the main branch. This approach ensures proper review and avoids potential issues for others.

@jakin6
Copy link

jakin6 commented Feb 12, 2025 via email

@NeroBlackstone
Copy link

Same problem. Any recommend solution?

@deyizhi
Copy link

deyizhi commented Feb 23, 2025

Same problem. Any recommend solution?同样的问题。有什么推荐的解决方案吗?

using markdown component without code block as before

@SaiShanmukkha
Copy link

🚀 Fix Implemented: Prevent <pre> from being Wrapped in <p> to Resolve Hydration Error (#770)

I've fixed this issue and created a PR to address it. The fix ensures that <pre> elements are no longer nested inside <p>, preventing hydration errors.

🔗 Pull Request: [#832](PR Link)

Would appreciate any feedback!
@LeyoNeuroAI @Asin-Junior-Honore @NeroBlackstone @deyizhi

@LeyoNeuroAI
Copy link
Author

looks good to me

@Asin-Junior-Honore
Copy link

Asin-Junior-Honore commented Feb 28, 2025

🚀 Fix Implemented: Prevent \<pre\> from being Wrapped in <p> to Resolve Hydration Error (#770)

I've fixed this issue and created a PR to address it. The fix ensures that \<pre\> elements are no longer nested inside <p>, preventing hydration errors.

🔗 Pull Request: [#832](PR Link)

Would appreciate any feedback! @LeyoNeuroAI @Asin-Junior-Honore @NeroBlackstone @deyizhi

Yeah, this is great! It fixes the hydration error. Thanks for the update! @SaiShanmukkha 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants