Files
02c2f11ec9 Enable missing suspense bailout by default (#60840)
`experimental.missingSuspenseWithCSRBailout` should be enabled by
default to help users to disciver unwrapped suspense boundaries.

Add more notes in the error doc about deprecation and temporary
workaround to disable it.

Closes NEXT-2157

---------

Co-authored-by: JJ Kasper <[email protected]>
2024-01-18 21:11:22 +01:00

37 lines
853 B
TypeScript

'use client'
import { Suspense } from 'react'
import { useSearchParams } from 'next/navigation'
function InnerPage() {
const searchParams = useSearchParams()
return (
<>
<h1 id="replacestate-searchparams">ReplaceState SearchParams</h1>
<pre id="my-data">{searchParams.get('query')}</pre>
<button
onClick={() => {
const url = new URL(window.location.href)
const previousQuery = url.searchParams.get('query')
url.searchParams.set(
'query',
previousQuery ? previousQuery + '-added' : 'foo'
)
window.history.replaceState({}, '', url)
}}
id="replace-searchparams"
>
Replace searchParam
</button>
</>
)
}
export default function Page() {
return (
<Suspense>
<InnerPage />
</Suspense>
)
}