Skip to content
Book a call

A Suspense boundary can hide your whole page from Google

· 3-minute read · Engineering · by Direct Softworks

Our contact page served 98 characters to a crawler. The navbar, twice, and nothing else. One hook was the reason, and the page looked perfect in a browser.

We found this on our own site, which is the only reason we can be this specific about it.

/contact was in the sitemap, returned 200, had a canonical tag, and had been sitting in Search Console under "Discovered, currently not indexed" for weeks. Every technical check passed. The page rendered beautifully in a browser.

Then we asked what a crawler actually receives:

curl -s -A "Googlebot" https://directsoftworks.ro/contact | wc -c

The body text came to 98 characters. It was the navigation menu, rendered twice for desktop and mobile, and nothing else. No heading, no copy, no form. The entire page was absent from the HTML.

What causes it

The component called useSearchParams().

In the Next.js App Router, a client component that reads search params has to sit inside a <Suspense> boundary. That is a documented requirement and the framework tells you about it. What it does not say loudly is what happens next: during static prerendering, the content inside that boundary is not rendered. The fallback is written into the HTML instead.

Our fallback was an empty <main> with a background colour, which is a perfectly sensible loading state and a catastrophic thing to serve as your entire page.

So the sequence is: build time, Next hits the boundary, cannot resolve search params because there is no request yet, emits the fallback, and ships that as the static HTML. In a browser, JavaScript loads, hydration replaces the fallback with the real page, and everything looks correct. To anything reading the HTML, the page is blank.

Why nothing caught it

This is the part worth dwelling on, because the failure defeats almost every check people run.

The page returns 200. The build succeeds with no warning. TypeScript is happy. The page is visually perfect in every browser and on every device. Lighthouse scores well, because it runs JavaScript. Any monitoring that checks for a string on the page passes, if the string is in the navbar.

Google's renderer does execute JavaScript eventually, so the page is not permanently invisible. But rendering is a second pass, queued separately and not guaranteed on any timetable, and for a site with little crawl budget it may simply not happen. Meanwhile the first pass sees a page with no content and files it accordingly.

The one test that catches it is the one nobody runs: fetch the URL with curl and read what comes back.

The fix

The search parameter was used exactly once, in a mount effect, to preselect a value from ?service=. It never needed the hook.

useEffect(() => {
  try {
    const s = new URLSearchParams(window.location.search).get("service");
    if (s && SERVICES.some((o) => o.value === s)) setService(s);
  } catch {
    /* nothing to preselect */
  }
}, []);

Reading window.location in an effect gets the same value at the same moment, needs no Suspense boundary, and lets the whole component render statically. The Suspense wrapper came out of the page entirely.

The page went from 98 characters to a fully server-rendered form.

The general rule

Anything that forces a Suspense boundary at the top of your page will remove that page from the static HTML.

In practice the triggers are useSearchParams, usePathname in some configurations, and any client component doing data fetching that suspends. The question to ask about each is whether the value is needed during render or merely after mount. If after mount, read it from the browser directly and the problem dissolves.

And separately: audit what you actually serve. One command, per important page:

curl -s -A "Googlebot" https://your-site/page | \
  sed 's/<script[^>]*>.*<\/script>//g; s/<[^>]*>/ /g' | tr -s ' ' | wc -c

If a commercial page returns a few hundred characters, you have found something. We ran it across every URL in our sitemap and /contact was the only one that failed, which is exactly the kind of result that would never have surfaced any other way. Same lesson as checking the shipped bundle rather than the server environment: look at the artefact the client receives, not at the thing you believe you configured.

More notes