Skip to content

fix(hydration): suppress React #418 errors from Nextra internals (SHA-2240)#209

Merged
Mlaz-code merged 1 commit into
mainfrom
paperclip/SHA-2240
May 7, 2026
Merged

fix(hydration): suppress React #418 errors from Nextra internals (SHA-2240)#209
Mlaz-code merged 1 commit into
mainfrom
paperclip/SHA-2240

Conversation

@Mlaz-code
Copy link
Copy Markdown
Collaborator

Summary

  • Add suppressHydrationWarning to <body> — guards against next-themes writing data-theme from localStorage before React reconciles; without this, ThemeProvider causes a body-level #418 on every cold page load
  • Remove i18n prop from Layout — docs has a single locale (en); the prop caused Nextra's Switchers component to mount LocaleSwitch in the footer on page-type routes, producing an "HTML vs text" structural mismatch between SSR and client trees (confirmed absent from built output via $L1c mount reference check)
  • Extend PostHog IGNORED_PATTERNS with React hydration error strings — defense-in-depth; the structural fixes are the real solution, but filtering prevents false-positive error tracking while residual instances fade post-deploy

Background

A PostHog handler change deployed 2026-05-04 surfaced latent React #418 hydration errors (26+ in a partial day). The errors predate the handler change; the new window.addEventListener('error') handler just made them visible.

QA

  • Build clean: 55 pages, 0 TypeScript/compile errors, 6,357 links fixed, Pagefind indexed 53 pages
  • LocaleSwitch mount reference (\$L1c) absent from rendered out/en/pricing.html → i18n removal effective
  • <body suppressHydrationWarning> and IGNORED_PATTERNS updates verified in source

Closes SHA-2240

🤖 Generated with Claude Code

…-2240)

Three targeted fixes for latent React hydration mismatches that became
visible after the PostHog error handler was added (2026-05-04):

1. Add suppressHydrationWarning to <body> — guards against next-themes
   writing data-theme to the body before React finishes reconciling;
   without this, ThemeProvider's localStorage read produces a body-level
   #418 on every cold page load.

2. Remove i18n prop from Layout — docs has a single locale (en). Passing
   i18n caused the Nextra Switchers component to render LocaleSwitch in
   the footer whenever hideSidebar=true (page-type routes), producing an
   "HTML vs text" structural difference between SSR and client trees.

3. Filter React hydration errors in PostHog IGNORED_PATTERNS — the errors
   predate the PostHog change; the new window.addEventListener('error')
   handler just made them visible. Patterns: "Hydration failed",
   "There was an error while hydrating", "Text content did not match".

Co-Authored-By: Paperclip <noreply@paperclip.ing>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs.sharpapi.io Ready Ready Preview, Comment May 7, 2026 2:00pm

Request Review

@Mlaz-code Mlaz-code force-pushed the paperclip/SHA-2240 branch from efedb77 to ea67128 Compare May 7, 2026 13:24
@Mlaz-code Mlaz-code closed this May 7, 2026
@Mlaz-code Mlaz-code reopened this May 7, 2026
@Mlaz-code Mlaz-code force-pushed the paperclip/SHA-2240 branch from ea67128 to 79e6cef Compare May 7, 2026 13:59
@Mlaz-code Mlaz-code merged commit 25b7d89 into main May 7, 2026
2 checks passed
@Mlaz-code Mlaz-code deleted the paperclip/SHA-2240 branch May 7, 2026 17:30
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