Repository navigation
[Workshops] Fix React hydration mismatch errors on workshop pages - #8101
Maanvi212006 merged 3 commits into
Conversation
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughEight workshop MDX pages remove paragraph wrappers, reformat workshop content, and rename iframe attributes to JSX camelCase forms. Text content and iframe sources remain unchanged. ChangesWorkshop MDX markup
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
da5d70f to
a337668
Compare
|
Preview deployment for PR #8101 removed. This PR preview was automatically pruned because we keep only the 3 most recently updated previews on GitHub Pages to stay within deployment size limits. If needed, push a new commit to this PR to generate a fresh preview. |
yi-nuo426
left a comment
There was a problem hiding this comment.
Review: Approve
I verified this fix compiles and behaves as described. Nothing blocking.
Verified
- Reproduced the root cause with the repo's own
@mdx-js/mdx(v3): the old multi-line<p>blocks compile to<p><_components.p>...</_components.p></p>- a nested<p>, which is invalid HTML. The browser auto-closes the outer tag, so SSR HTML and the client tree diverge and hydration fails with #418. The PR description is accurate. - The new markup compiles flat: bare paragraphs become a single
<_components.p>, and the unwrapped trainer lines (<strong>/<a>/<br />runs) also compile to one flat paragraph with no new nesting. Nopoverride exists inMDXProvider(root-wrapper.js), so default<p>rendering applies - consistent and safe. frameBorder/allowFullScreenare the correct JSX props.- Coverage is complete: all 8 files under
src/collections/workshops/are fixed, and none still contain<p>,frameborder, orallowfullscreenon this branch. - Content preserved: prose and iframe
srcvalues are unchanged; the<ul>reformat in the Meshery Docs file is whitespace-only in effect. - Checks are green (build, DCO, triage).
Non-blocking suggestions (follow-ups, not required here)
- Same bug patterns exist outside workshops and can throw the same hydration errors. Lowercase
frameborder/allowfullscreenremain in e.g.src/collections/blog/2021/2021-10-09-an-introduction-to-meshery/index.mdx,src/collections/service-mesh-workshops/2021_02_22-istiocon/index.mdx, plus files under events, news, and resources; manual multi-line<p>blocks also appear in several blog and integration files. Suggest a follow-up issue to sweep these. - Nit: the recording iframes have no
titleattribute (accessibility). Considertitle="Workshop Recording: <topic>"if these lines are touched again. - Nit (pre-existing):
target="_blank"links in these MDX files lackrel="noopener noreferrer", while the workshop template itself usesrel="noreferrer"(src/sections/Learn/Workshop-single/index.js). Worth a follow-up sweep. - Optional:
frameBorder="0"is deprecated in HTML5; the existing inlinestyleprop could carryborder: "0"instead. Fine to leave as-is.
LGTM - thanks for the precise root-cause writeup.
|
Thank you for the detailed review and thorough verification, @yi-nuo426! I really appreciate the feedback and non-blocking suggestions. Once this is merged, I'd be happy to open a follow-up issue to sweep and fix the remaining files across the blog, events, and resources collections as you suggested! |
…ages - Remove redundant manual <p> tags wrapping paragraphs in workshop MDX files to eliminate nested <p><p> DOM generation and resolve React hydration mismatch errors layer5io#418 and layer5io#423 - Update iframe attributes to standard JSX camelCase properties (frameBorder, allowFullScreen) - Apply fix across all 8 workshop collection entries Fixes layer5io#8088 Signed-off-by: tejaswiverma <tejaswiverma121@gmail.com>
e51d6a0 to
12900ca
Compare
|
@Maanvi212006 i have updated the changes as per requested and let me know should i add this pr into agenda item too ? |
Description
This PR fixes #8088
Root Cause
Workshop pages (
/learn/workshops/...) were throwing multiple React hydration mismatch errors (Minified React error #418andMinified React error #423) during client-side hydration:<p>elements from MDX: Explicit manual<p>and</p>tags wrapped around Markdown paragraphs caused the MDX v3 compiler to generate<p><_components.p>...</_components.p></p>. In standard HTML,<p>cannot appear as a descendant of<p>. The browser's HTML parser auto-closed outer paragraph tags on initial page load (<p></p><p>...</p>), leading to a DOM structure mismatch between SSR HTML and the client React tree.<iframe>elements used HTML lowercaseframeborder="0"and booleanallowfullscreeninstead of standard React JSX propertiesframeBorder="0"andallowFullScreen.Changes Made
<p>tags from all 8 workshop collection files undersrc/collections/workshops/, allowing MDX to parse paragraphs naturally into valid, unnested HTML:src/collections/workshops/2025_07_19_meshery_models/index.mdxsrc/collections/workshops/2025_05_29_meshery_server/index.mdxsrc/collections/workshops/2025_05_15_meshery_ui/index.mdxsrc/collections/workshops/2025_05_08_meshery_ui_e2e/index.mdxsrc/collections/workshops/2025_04_30_meshery_cli/index.mdxsrc/collections/workshops/2025_04_24_meshery_build_and_release/index.mdxsrc/collections/workshops/2025_04_17_meshery_cli_e2e/index.mdxsrc/collections/workshops/2025_04_10_meshery_docs/index.mdx<iframe>attributes across all workshop recordings to standard JSX camelCase properties (frameBorder="0"andallowFullScreen).Notes for Reviewers
@mdx-js/mdxcompiler and browser testing: 0 hydration errors, 0 DOM nesting warnings, and identical visual appearance.Signed commits
Summary by CodeRabbit