Unverified Commit 4ba64e2e authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Remove early return that is duplicated in useSearchParams (#58545)

## What?

Noticed that the return is the same, so we don't have to add this specific return.
parent 391471b3
import { throwWithNoSSR } from '../../shared/lib/lazy-dynamic/no-ssr-error'
import { staticGenerationAsyncStorage } from './static-generation-async-storage.external'
export function bailoutToClientRendering(): boolean | never {
export function bailoutToClientRendering(): void | never {
const staticGenerationStore = staticGenerationAsyncStorage.getStore()
if (staticGenerationStore?.forceStatic) {
return true
return
}
if (staticGenerationStore?.isStaticGeneration) {
throwWithNoSSR()
}
return false
}
......@@ -90,10 +90,8 @@ export function useSearchParams(): ReadonlyURLSearchParams {
// AsyncLocalStorage should not be included in the client bundle.
const { bailoutToClientRendering } =
require('./bailout-to-client-rendering') as typeof import('./bailout-to-client-rendering')
if (bailoutToClientRendering()) {
// TODO-APP: handle dynamic = 'force-static' here and on the client
return readonlySearchParams
}
// TODO-APP: handle dynamic = 'force-static' here and on the client
bailoutToClientRendering()
}
return readonlySearchParams
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment