← All errors · Next.jsNext.js App Router & config errors

useSearchParams() should be wrapped in a suspense boundary

Exact error

useSearchParams() should be wrapped in a suspense boundary at page "/search". Read more: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout

What it means

During a production build of a statically rendered page, a client component calls useSearchParams() without a <Suspense> boundary, so Next.js would have to client-render the whole page.

Likely causes

How to fix it

  1. Wrap the component that uses search params in Suspense:

    import { Suspense } from 'react';
    import SearchBar from './SearchBar'; // 'use client' + useSearchParams
    
    export default function Page() {
      return (
        <Suspense fallback={null}>
          <SearchBar />
        </Suspense>
      );
    }

Prevent this next time

FAQ

What does "useSearchParams() should be wrapped in a suspense boundary" mean?

During a production build of a statically rendered page, a client component calls useSearchParams() without a <Suspense> boundary, so Next.js would have to client-render the whole page.

What usually causes it?

Calling useSearchParams() in a component rendered by a static page without Suspense.

How do I fix it?

1. Wrap the component that uses search params in Suspense:

Related errors

Get new fixes weekly

No spam. Unsubscribe anytime. Privacy