Hydration and lazy loading pitfalls
How hydration and lazy loading hide content, delay interaction and shift layouts, and the Google guidance for doing both safely.

In short: hydration and lazy loading are performance tools, and both can quietly remove content from what a crawler sees or slow down what a visitor feels. Use viewport-based loading for what is below the fold, keep primary content in the server HTML, and keep the first interaction light. This article is part of the JavaScript SEO guide.
Hydration in one paragraph
With server-side rendering or static generation, the server sends complete HTML. The browser shows it immediately, then downloads the framework’s JavaScript, which attaches event handlers and makes the page interactive. That second step is hydration. It lets crawlers and visitors see content fast, but it adds a window where the page looks ready and is not, and it needs the client to produce the same tree the server rendered.
Hydration pitfalls
| Pitfall | What happens | What to do |
|---|---|---|
| Content only added after hydration | Text loaded in an effect after mount is not in the server HTML | Fetch primary content on the server, and use client effects only for secondary extras |
| Hydration mismatch | Server and client render different output, causing errors and re-renders | Keep markup deterministic; avoid values that differ by environment, such as dates, random numbers and viewport checks, in the first render |
| Heavy scripts block interaction | The page looks ready but taps and clicks wait for the main thread | Reduce JavaScript, split bundles and defer what the first screen does not need. The INP entry explains how interaction is measured. |
| Layout shifts on hydration | Client-only components appear and push content down | Reserve space for them with fixed dimensions or skeletons. The Core Web Vitals entry explains how layout shift is measured. |
| Personalization swaps content | Consent banners, geo or A/B variants change the page after load | Keep the default state complete and indexable; do not hide the main content behind a variant |
| Everything is hydrated | Static content ships code it does not need | Prefer server components, partial or island hydration where your framework supports it |
Google’s guidance for JavaScript sites makes the same point from the crawler side: what is in the rendered HTML can be indexed, and what depends on events or failed requests may not be. The full explanation is in Google’s JavaScript SEO basics.
Lazy loading, the safe way
Google’s lazy-loading guidance is specific:
- Load by viewport visibility. Use the browser’s built-in lazy loading for images and iframes, the IntersectionObserver API, or a library that loads content when it enters the viewport.
- Do not depend on user actions. Google does not scroll, click or type, so content that needs those never loads for it.
- Do not lazy-load what is visible at first. It slows the page and users notice.
- Keep image URLs in
src. The image and video URLs should appear in thesrcattribute of<img>and<video>elements in the rendered HTML.
Google’s lazy loading guidance explains how to do this safely.
Infinite scroll
- Give each content chunk its own persistent, unique URL.
- Make each URL always show the same content, using absolute page numbers such as
?page=12and not relative ones such as?date=yesterday. - Link the URLs to each other in sequence so crawlers can reach the whole set.
- Update the browser URL with the History API as a new chunk becomes the main content, so users can refresh, share and bookmark it.
The LCP trap
The largest visible element on first load, often a hero image, is usually the LCP element. Lazy-loading it delays LCP. Mark it as high priority, leave it eager, and lazy-load below-the-fold images instead. Google’s article on optimizing LCP shows how to prioritize this image.
The CLS trap
Lazy-loaded images without dimensions push content down when they load. Give every image and embed a width and height, or an aspect ratio, so space is reserved. CLS explains how this shift is measured.
How to test
- URL Inspection. Run a live test, open the rendered HTML and search for the content and image URLs that should be there. How to check what Google really sees walks through this test in more detail.
- Disable scrolling assumptions. Load the page and look at the HTML without scrolling. Anything missing that needs a scroll is a risk.
- Trace the first interaction. Use the performance panel to see long tasks during and after hydration.
- Compare field data. Check INP and CLS in Search Console’s Core Web Vitals report, not only a lab test.
A short checklist
- Primary content and links are in the server HTML.
- Below-the-fold images and iframes use native lazy loading, above-the-fold ones do not.
- The LCP image is eager and high priority.
- Images and embeds have dimensions.
- Infinite scroll has unique, sequential, linked URLs.
- Hydration is light, and the first render matches the server.
- The default, unpersonalized page is complete.
This is the kind of thing my JavaScript SEO work clients bring me, contact me to discuss yours.
FAQ
Does lazy loading hurt SEO?
Not when it is done by viewport visibility with standard techniques. It hurts when content only loads after a scroll, click or swipe, because Google does not trigger those, or when the main image or text above the fold is lazy-loaded and slows the page.
What is a hydration mismatch?
It is when the HTML the server rendered differs from what the client renders on its first pass. It can cause errors, flicker, layout shifts and, if the two versions contain different content, uncertainty about what is the real page.
Should I lazy-load the hero image?
No. The largest image visible on first load is usually the LCP element, and lazy-loading it delays it. Lazy-load images below the fold.
Sources
- Fix lazy-loaded website content · Google Search Central
- Understand JavaScript SEO basics · Google Search Central
- Fix search-related JavaScript problems · Google Search Central
- Largest Contentful Paint (LCP) · web.dev
- Cumulative Layout Shift (CLS) · web.dev
- Interaction to Next Paint (INP) · web.dev
- Optimize Largest Contentful Paint · web.dev
- URL Inspection tool · Google Search Console Help
Keep reading
- Structured data with JavaScript and Tag ManagerWhen it is safe to generate JSON-LD in the browser or with Google Tag Manager, the risks for products, and how to test and keep it in sync with the page.
- Next.js and Nuxt SEO checklistA framework-level checklist for metadata, rendering modes, status codes, redirects, sitemaps and international routing in Next.js and Nuxt.
- SSR, SSG or CSR: how to choose for SEOA practical way to pick a rendering approach by how often content changes, how personalized it is and how much the page matters for search.
Related glossary terms
Want this applied to your site?
Tell me about your site and I’ll suggest the next step.
Work with me Services