Skip to content

Verify SSR fixture hydration - #232

Merged
infeng merged 1 commit into
masterfrom
maintenance/week4-ssr-hydration-check
Aug 31, 2026
Merged

Verify SSR fixture hydration#232
infeng merged 1 commit into
masterfrom
maintenance/week4-ssr-hydration-check

Conversation

@infeng

@infeng infeng commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Reproduction

After react-viewer@3.2.4 changed the CommonJS entry to export the Viewer component directly, the SSR fixture still read require("../dist/index").default. The fixture continued to compile, but browser hydration received an undefined component, removed the server-rendered root, and threw a runtime error.

Root cause and fix

  • Consume the direct CommonJS component export in the SSR fixture.
  • Add a jsdom hydration check that evaluates the built client bundle against server markup, clicks the fixture button, and asserts that Viewer opens.
  • Include the hydration check in npm run verify after the SSR client build.

Verification

  • npm ci --ignore-scripts
  • npm run verify
  • Chromium 149: initial SSR HTML retained the open button; hydration changed it to close; the Viewer image and labelled close control rendered with no page errors.
  • Registry scan found only https://registry.npmjs.org/.

@infeng
infeng merged commit 466dab7 into master Aug 31, 2026
2 checks passed
@infeng
infeng deleted the maintenance/week4-ssr-hydration-check branch August 31, 2026 07:29
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