Loading...
Loading...
Ensures zero-mismatch integrity between server-rendered HTML and client-side React trees. Use when debugging hydration errors, fixing text content mismatches, handling browser extension DOM pollution, implementing selective hydration with Suspense, using the React 19 use() hook for deterministic server-to-client data bridges, or applying Next.js use cache for data drift prevention. Use for hydration mismatch, SSR, hydrateRoot, suppressHydrationWarning, onRecoverableError, two-pass rendering.
npx skill4agent add oakoss/agent-skills hydration-guardianuse()'use cache'onRecoverableError| Pattern | Approach | Key Points |
|---|---|---|
| Selective hydration | | Hydrates independently; prioritizes user interaction |
| Deterministic bridge | | Direct server-to-client data transition (React 19) |
| Cache directive | | Share exact server result with client during hydration |
| Two-pass rendering | | First render matches server; second adds client content |
| Client-only skip | | Exclude component from server render entirely |
| Error monitoring | | Detect and report silent hydration recovery |
| Error reporting | React 19 single-diff error format | Pinpoints exact mismatch location with unified diff output |
| Error callbacks | | Granular error handling on |
| Date/time safety | UTC normalization or server-synced context | Prevent locale-dependent hydration mismatches |
| Extension resilience | Test with common browser extensions active | Detect DOM pollution from translators, dark-mode tools |
| Error Message | Likely Cause | Corrective Action |
|---|---|---|
| Non-deterministic render (dates, random values) | Use two-pass rendering or |
| Client renders content server did not | Move client-only code to |
| Invalid HTML nesting ( | Fix HTML structure; browsers auto-correct causing drift |
| Server-only attributes not on client | Ensure attribute parity or use |
| Extension-modified DOM or major mismatch | Check for browser extensions; verify HTML validity |
| Mistake | Correct Pattern |
|---|---|
Using | Fix the root cause; suppress only on leaf elements with unavoidable differences |
Accessing | Wrap client-only code in |
Using | Use UTC normalization, server-cached values, or two-pass rendering |
| Ignoring silent hydration recovery in production | Configure |
Using | Ensure identical content or use a dedicated |
Checking | Use two-pass rendering; the check runs on server too (it returns false) |
Nesting | Fix invalid HTML nesting; browsers correct it causing server/client drift |
ExploreTaskPlan