Suspense Build Fails to Detect useSearchParams() in Prop-Passed Components #88812
-
SummaryWhen detecting useSearchParams() at build time with Suspense, does the detection fail if the component is passed and used as a prop? detectexport function A() {
return (
<Flex
direction="column"
gap={8}
style={{ marginTop: '8px', marginBottom: '16px' }}
>
<SearchBar />
<DataTable />
</Flex>
);
}detect failexport function B() {
return (
<TableLayout
searchSection={<SearchBar />}
tableSection={<DataTable />}
/>
);
}Each SearchBar component uses useSearchParams() internally, but case B does not fail during the build (it passes even without Suspense). Additional informationuseSearchParams() should be wrapped in a suspense boundary at page "/A". Read more: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailoutExampleNo response |
Beta Was this translation helpful? Give feedback.
Answered by
JeevanYewale
Jan 21, 2026
Replies: 1 comment 1 reply
-
|
This is a known behavior with Next.js build-time detection. When components are passed as props, the static analysis can't detect Why this happens:
Solutions:
export function B() {
return (
<Suspense fallback={<div>Loading...</div>}>
<TableLayout
searchSection={<SearchBar />}
tableSection={<DataTable />}
/>
</Suspense>
);
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
hyonun321
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a known behavior with Next.js build-time detection. When components are passed as props, the static analysis can't detect
useSearchParams()usage at build time.Why this happens:
useSearchParams()Solutions: