Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Hydration mismatch or blank page on slow JS: how to fix it

SEO-144Medium impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

Many modern sites (React, Next.js, Nuxt, Vue, Svelte and similar) send HTML from the server first. Then JavaScript runs in the browser and attaches behaviour to that HTML. This step is called hydration.

A hydration mismatch means the browser builds something different from the server HTML. Typical causes are dates, random IDs, window or localStorage checks, and content that depends on the visitor's device or cookies. The framework may throw a console error, discard the server HTML, or leave buttons that do not respond.

Why it costs you leads or sales

Visitors do not wait. If your form, price or buy button is missing for several seconds, many will leave. If hydration fails, the button may be visible but dead, so a click does nothing. Search crawlers and AI tools may also see thin or empty content, which hurts visibility.

Where a slow or failed hydration breaks the funnel
  1. Ad or search clickVisitor lands on the page
  2. HTML arrivesServer sends markup or an empty shell
  3. HydrationMismatch or slow script leaves a blank or dead page
  4. Form or buy buttonMissing or not clickable
  5. Lead or saleNever happens

The page loads, but scripts fail or take too long, so everything after is lost.

A page that never finishes rendering

The script stalls, so the visitor sees an empty or broken page.

Visitors who see a usable page by connection speedExample numbers
Visitors who see a usable page by connection speed (example)Fast Wi-Fi: 95 %; Average 4G: 80 %; Slow 3G: 45 %03673958045Fast Wi-FiAverage 4GSlow 3G%

Example: illustrative numbers showing how a heavy script bundle can lose more visitors as the connection slows. Not real data.

How to check if your site has it

Test for hydration errors and slow-JS blank pages
  1. Open the console

    In Chrome, open DevTools (F12) and the Console tab, then reload. Look for messages such as 'Hydration failed', 'Text content does not match server-rendered HTML' or 'Minified React error #418, #423 or #425'.

  2. Throttle the network and CPU

    In DevTools, open Network and choose 'Slow 4G' or 'Slow 3G'. In Performance, set CPU to 4x or 6x slowdown. Reload and watch what the page shows.

  3. Disable JavaScript

    Open the Command Menu (Ctrl or Cmd + Shift + P), type 'Disable JavaScript' and reload. Check whether your headline, text and main call to action still appear.

  4. View the raw HTML

    Use View Source (not Inspect). If the body holds only an empty div such as <div id="root"></div>, the content depends fully on scripts.

  5. Try real devices

    Open the page on an older phone over mobile data and click the main button. Check it responds.

How to fix it

The fix has two parts: make server and browser output identical, and make sure key content does not depend on slow scripts.

Fix hydration mismatches and blank pages
  1. Find the differing element

    Use the dev-build error. It usually names the text or attribute that differs. Look for dates, times, random numbers, locale formatting and user-specific values.

  2. Move browser-only logic out of the first render

    Do not read window, document, localStorage or cookies while rendering. Read them after mount, inside an effect, so the first render matches the server.

  3. Fix unstable values

    Generate IDs with the framework's stable ID tool (for example React useId) instead of Math.random(). Format dates with a fixed locale and time zone.

  4. Check your HTML is valid

    Invalid nesting, such as a div inside a p, makes the browser rewrite the DOM and causes a mismatch. Fix it in the component.

  5. Server-render the key content

    Make sure the headline, copy, price and main call to action are in the server HTML, using server-side rendering or static generation rather than client-only rendering.

  6. Cut script weight

    Split bundles, lazy-load below-the-fold code, remove unused libraries and defer non-essential third-party tags so hydration finishes sooner.

React: render browser-only values after mountjavascript
import { useEffect, useState } from 'react';

export default function Greeting() {
  const [name, setName] = useState('');

  useEffect(() => {
    // Runs only in the browser, after hydration
    setName(localStorage.getItem('name') || '');
  }, []);

  return <p>{name ? `Welcome back, ${name}` : 'Welcome'}</p>;
}
What to do on your platform
  1. Use a dev build to find the mismatch

    Run the dev server, open the console and fix each hydration warning at its source.

  2. Render key content on the server

    In Next.js or Nuxt, use server rendering or static generation for landing pages instead of client-only components.

  3. Add a fallback

    Put essential text and a plain HTML form or link in the server markup so the page is usable if scripts fail.

Client-only page vs server-rendered page

Before

  • Source shows an empty root div
  • Console shows hydration errors
  • Button dead on slow connections
  • Crawlers see little content

After

  • Headline, copy and button in the server HTML
  • No hydration warnings
  • Button works once scripts load
  • Crawlers and AI tools can read the content

How to confirm it's fixed

Confirmation checks
  • The console shows no hydration warnings after a hard reload
  • With JavaScript disabled, the headline and main text still appear
  • On Slow 4G with 4x CPU slowdown, content shows quickly and the button works
  • View Source contains your key copy and call to action
  • Submitting the form or starting checkout works from a phone
  • Search Console URL Inspection, View tested page, shows the content in the rendered HTML

How to prevent it happening again

Prevention habits
  • Treat hydration warnings in development as bugs to fix before release
  • Keep browser-only code inside effects that run after mount
  • Set a script size budget and review it when you add libraries
  • Test key pages with throttling before each release
  • Add new third-party tags through a tag manager and check their effect on load
  • Monitor your main journeys so a broken release is caught fast

How FunnelGuard handles this

FunnelGuard detects this only partly. A robot visitor runs your real journeys on a schedule, such as a lead form or checkout. If the page is blank or the form, button or field never appears because scripts failed, the step reports an element-not-found error. You get one alert, after a second-region re-check, with a screenshot of what the robot saw and a likely cause.

Questions people ask

What is a hydration mismatch?

A hydration mismatch happens when the HTML a server sends differs from what the browser's JavaScript builds on first render. The framework warns in the console and may discard the server HTML or leave parts of the page unresponsive. Common causes are dates, random IDs and browser-only values.

Why is my page blank until JavaScript loads?

The server probably sends an empty shell, such as a single root div, and the content is built entirely by scripts. On slow connections or devices, visitors see white space until the bundle downloads and runs. Server-side rendering or static generation puts the content in the first HTML.

How do I fix 'Text content does not match server-rendered HTML'?

Find the text that differs, usually a date, time, random value or something read from the browser. Make the first render identical on server and browser, and move browser-only values into an effect that runs after mount. Fix date formats by using a fixed locale and time zone.

How do I test my site on slow JavaScript?

In Chrome DevTools, set Network to Slow 4G and CPU to 4x or 6x slowdown in the Performance panel, then reload. You can also disable JavaScript from the Command Menu to see what the raw HTML contains. Check that your headline and main button appear and work.

Does a hydration error hurt SEO?

It can. If key content only appears after scripts run, or hydration fails and the content disappears, crawlers and AI tools may see thin pages. Keeping important text in the server HTML reduces that risk.

Can FunnelGuard detect hydration mismatches?

Only in part. It runs your real journeys and reports an element-not-found error with a screenshot when a form or button does not appear. It does not read console warnings or compare server and browser HTML, so you should still test by hand.

Why does my button not work after the page loads?

Hydration may have failed, so the button is visible server HTML with no click handler attached. Check the console for hydration errors and for script errors, and test with throttling. Fixing the mismatch usually restores the button.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: Element-not-found and screenshots on journeys.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.