json-schema-org / json-schema-org/website

🐛 Bug: React Hydration Mismatch & Unrecognized <tableofcontent> tag warnings

Open
#2,355 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🐛 Bug invalid Status: Triage
Dominant language
HTML
Stars
169
Forks
484
Avg merge
2d 2h
Merged PRs (30d)
6

Description

Describe the bug

While running the JSON Schema website locally, I noticed two distinct React warnings flooding the developer console on the Homepage (/) and Documentation (/docs) pages:

  • Hydration Mismatch & Missing src Errors: The initial Server-Side Rendered (SSR) HTML does not match the Client-side React tree. Specifically, theme-dependent SVG icons in the Sidebar drop expected src attributes, and elements like the APIDeck logo have mismatched alt text (newline vs space) during hydration. This forces React to discard the SSR HTML and re-render the components.

  • Unrecognized Tag: A warning states: Warning: The tag is unrecognized in this browser. This occurs because the custom table of contents component is written as lowercase () in the markdown files, causing React to treat it as an invalid native HTML element instead of a mapped custom component.

Steps To Reproduce
  1. Clone the repository and run yarn dev.
  2. Navigate to the Homepage (/) or the Docs page (/docs).
  3. Open the browser Developer Tools and go to the Console tab.
  4. Perform a Hard Refresh to ensure you receive the fresh server-rendered HTML.
  5. See the React Hydration warnings and the unrecognized tag warnings in the console logs.
Expected Behavior
  1. The TableOfContent component should be capitalized properly (e.g., ) in both the .md documents and the markdown-to-jsx parser overrides to avoid invalid HTML tag warnings.

  2. The console should be completely clean of Next.js hydration warnings. Theme-dependent images and SVG files should either define a default src on the server or wait until the client is mounted to render, to avoid SSR vs. Client mismatch.

Screenshots
Image
Device Information [optional]
- OS:
- Browser:
- version:
Are you working on this issue?

Yes

Do you think this work might require an [Architectural Decision Record (ADR)]? (significant or noteworthy)

No

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run yarn dev and reproduce the warnings on / and /docs with a hard refresh. Inspect the markdown-to-JSX parser overrides and the theme-dependent Sidebar SVGs and APIDeck logo mentioned in the report. Done means the TableOfContent warning and the hydration warnings no longer appear in the browser console.

Written by the indexing model from the issue text.

Assessment

Tech stack
markdown, next.js, react
Domain
documentation, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.