Skip to content

fix: suppress expected Background hydration mismatch, allow vercel.live CSP#93

Open
Samurai33 wants to merge 1 commit into
mainfrom
fix/hydration-and-vercel-live-csp
Open

fix: suppress expected Background hydration mismatch, allow vercel.live CSP#93
Samurai33 wants to merge 1 commit into
mainfrom
fix/hydration-and-vercel-live-csp

Conversation

@Samurai33

Copy link
Copy Markdown
Owner

Summary

Two issues reported directly from the live browser console:

  1. Uncaught Error: Minified React error #418 - Background.tsx's floating particles use Math.random() in a useState initializer, which runs during both server and client's shared render pass and necessarily produces different values (intentional - each pageview gets its own scatter). Without suppressHydrationWarning, React treated the expected divergence as a hydration error. Tried deferring generation to a useEffect first, but that trips the React Compiler's react-hooks/set-state-in-effect rule - suppressHydrationWarning on the affected divs is the documented fix for exactly this case.
  2. CSP blocked vercel.live/_next-live/feedback/feedback.js - Vercel's Preview Comments toolbar, injected on preview deployments. Added vercel.live to script-src/connect-src/frame-src.

Test plan

  • lint: 0 errors (previously 1 new error from the useEffect attempt, reverted)
  • type-check + test (27/27) + build all clean

…ve in CSP

Reported directly from the browser console on the live site:

- "Uncaught Error: Minified React error #418" - Background.tsx's particle
  positions use Math.random() in a useState initializer that runs during
  both the server and client's shared render pass, so they necessarily
  differ. That's intentional (each pageview gets its own scatter), but
  without suppressHydrationWarning React treated the mismatch as an error
  instead of the expected divergence it is. Tried moving generation into a
  useEffect first, but that trips the React Compiler's
  react-hooks/set-state-in-effect lint rule (setState synchronously in an
  effect) - suppressHydrationWarning on the affected divs is the officially
  documented fix for exactly this "value legitimately differs per render"
  case and needs no lint exception.

- CSP blocked https://vercel.live/_next-live/feedback/feedback.js - that's
  Vercel's Preview Comments/feedback toolbar, injected on preview (branch)
  deployments only. Added vercel.live to script-src/connect-src/frame-src.

Verified with lint (0 errors) + type-check + test (27/27) + build.
@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
v0-cyber-justica Ready Ready Preview, Comment, Open in v0 Jul 12, 2026 4:44pm

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