mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
`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]>
70 lines
1.7 KiB
TypeScript
70 lines
1.7 KiB
TypeScript
'use client'
|
|
|
|
import { Suspense } from 'react'
|
|
import { useSearchParams } from 'next/navigation'
|
|
|
|
function InnerPage() {
|
|
const searchParams = useSearchParams()
|
|
return (
|
|
<>
|
|
<h1 id="pushstate-string-url">PushState String Url</h1>
|
|
<pre id="my-data">{searchParams.get('query')}</pre>
|
|
<button
|
|
onClick={() => {
|
|
const previousQuery = new URL(window.location.href).searchParams.get(
|
|
'query'
|
|
)
|
|
const url = `?query=${
|
|
previousQuery ? previousQuery + '-added' : 'foo'
|
|
}`
|
|
|
|
window.history.pushState({}, '', url)
|
|
}}
|
|
id="push-string-url"
|
|
>
|
|
Push searchParam using string url
|
|
</button>
|
|
|
|
<button
|
|
onClick={() => {
|
|
const previousQuery = new URL(window.location.href).searchParams.get(
|
|
'query'
|
|
)
|
|
const url = `?query=${
|
|
previousQuery ? previousQuery + '-added' : 'foo'
|
|
}`
|
|
|
|
window.history.pushState(null, '', url)
|
|
}}
|
|
id="push-string-url-null"
|
|
>
|
|
Push searchParam with null data param
|
|
</button>
|
|
|
|
<button
|
|
onClick={() => {
|
|
const previousQuery = new URL(window.location.href).searchParams.get(
|
|
'query'
|
|
)
|
|
const url = `?query=${
|
|
previousQuery ? previousQuery + '-added' : 'foo'
|
|
}`
|
|
|
|
window.history.replaceState(undefined, '', url)
|
|
}}
|
|
id="push-string-url-undefined"
|
|
>
|
|
Push searchParam with undefined data param
|
|
</button>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default function Page() {
|
|
return (
|
|
<Suspense>
|
|
<InnerPage />
|
|
</Suspense>
|
|
)
|
|
}
|