Skip to content

Commit

Permalink
Reland "[dynamicIO] warn for disallowed dynamic in dev" (#71567)
Browse files Browse the repository at this point in the history
Reverts #71566 which relands #71526 

merge after 15 is released
  • Loading branch information
gnoff authored Oct 21, 2024
1 parent 51bfe3c commit 19e2edc
Show file tree
Hide file tree
Showing 37 changed files with 1,432 additions and 1,027 deletions.
26 changes: 6 additions & 20 deletions packages/next/src/client/components/client-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,13 @@ export function ClientPageRoot({
)
}

if (store.isStaticGeneration) {
// We are in a prerender context
const { createPrerenderSearchParamsFromClient } =
require('../../server/request/search-params') as typeof import('../../server/request/search-params')
clientSearchParams = createPrerenderSearchParamsFromClient(store)
const { createSearchParamsFromClient } =
require('../../server/request/search-params') as typeof import('../../server/request/search-params')
clientSearchParams = createSearchParamsFromClient(searchParams, store)

const { createPrerenderParamsFromClient } =
require('../../server/request/params') as typeof import('../../server/request/params')

clientParams = createPrerenderParamsFromClient(params, store)
} else {
const { createRenderSearchParamsFromClient } =
require('../../server/request/search-params') as typeof import('../../server/request/search-params')
clientSearchParams = createRenderSearchParamsFromClient(
searchParams,
store
)
const { createRenderParamsFromClient } =
require('../../server/request/params') as typeof import('../../server/request/params')
clientParams = createRenderParamsFromClient(params, store)
}
const { createParamsFromClient } =
require('../../server/request/params') as typeof import('../../server/request/params')
clientParams = createParamsFromClient(params, store)

return <Component params={clientParams} searchParams={clientSearchParams} />
} else {
Expand Down
10 changes: 2 additions & 8 deletions packages/next/src/client/components/client-segment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,10 @@ export function ClientSegmentRoot({
)
}

const { createPrerenderParamsFromClient } =
const { createParamsFromClient } =
require('../../server/request/params') as typeof import('../../server/request/params')
clientParams = createParamsFromClient(params, store)

if (store.isStaticGeneration) {
clientParams = createPrerenderParamsFromClient(params, store)
} else {
const { createRenderParamsFromClient } =
require('../../server/request/params') as typeof import('../../server/request/params')
clientParams = createRenderParamsFromClient(params, store)
}
return <Component {...slots} params={clientParams} />
} else {
const { createRenderParamsFromClient } =
Expand Down
Loading

0 comments on commit 19e2edc

Please sign in to comment.