Skip to content

Commit 5868f1f

Browse files
committed
WIP debug
1 parent 8dfa939 commit 5868f1f

File tree

6 files changed

+43
-1
lines changed

6 files changed

+43
-1
lines changed

bench/basic-app/app/page.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22

33
export default function Page() {
4-
return <h1>My Page</h1>
4+
return <h1>My Page123</h1>
55
}
66

77
export const dynamic = 'force-dynamic'

packages/next/src/client/app-index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ export async function hydrate(
310310
const initialRSCPayload = await initialServerResponse
311311

312312
let deploymentId = getDeploymentId()
313+
console.log('setAppBuildId', { buildId: initialRSCPayload.b, deploymentId })
313314
// setAppBuildId should be called only once, during JS initialization
314315
// and before any components have hydrated.
315316
if (initialRSCPayload.b) {

packages/next/src/client/components/router-reducer/fetch-server-response.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,12 @@ export async function fetchServerResponse(
242242

243243
const flightResponse = await flightResponsePromise
244244

245+
console.log(
246+
'softnav',
247+
res.headers.get(NEXT_BUILD_ID_HEADER),
248+
flightResponse.b,
249+
getAppBuildId()
250+
)
245251
if (
246252
(res.headers.get(NEXT_BUILD_ID_HEADER) ?? flightResponse.b) !==
247253
getAppBuildId()

packages/next/src/client/components/segment-cache/cache.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,6 +1550,14 @@ export async function fetchRouteOnCacheMiss(
15501550
headers
15511551
)
15521552

1553+
console.log('Cache 1', {
1554+
header: response.headers.get(NEXT_BUILD_ID_HEADER),
1555+
rscId: serverData.buildId,
1556+
buildId: getAppBuildId(),
1557+
map:
1558+
(response.headers.get(NEXT_BUILD_ID_HEADER) ?? serverData.buildId) !==
1559+
getAppBuildId(),
1560+
})
15531561
if (
15541562
(response.headers.get(NEXT_BUILD_ID_HEADER) ?? serverData.buildId) !==
15551563
getAppBuildId()
@@ -1615,6 +1623,12 @@ export async function fetchRouteOnCacheMiss(
16151623
headers
16161624
)
16171625

1626+
console.log(
1627+
'Cache 2',
1628+
response.headers.get(NEXT_BUILD_ID_HEADER),
1629+
serverData.b,
1630+
getAppBuildId()
1631+
)
16181632
if (
16191633
(response.headers.get(NEXT_BUILD_ID_HEADER) ?? serverData.b) !==
16201634
getAppBuildId()
@@ -1759,6 +1773,12 @@ export async function fetchSegmentOnCacheMiss(
17591773
prefetchStream,
17601774
headers
17611775
)
1776+
console.log(
1777+
'Cache 3',
1778+
response.headers.get(NEXT_BUILD_ID_HEADER),
1779+
serverData.buildId,
1780+
getAppBuildId()
1781+
)
17621782
if (
17631783
(response.headers.get(NEXT_BUILD_ID_HEADER) ?? serverData.buildId) !==
17641784
getAppBuildId()
@@ -2051,6 +2071,12 @@ function writeDynamicRenderResponseIntoCache(
20512071
route: FulfilledRouteCacheEntry,
20522072
spawnedEntries: Map<SegmentRequestKey, PendingSegmentCacheEntry> | null
20532073
): Array<FulfilledSegmentCacheEntry> | null {
2074+
console.log(
2075+
'Cache 4',
2076+
response.headers.get(NEXT_BUILD_ID_HEADER),
2077+
serverData.b,
2078+
getAppBuildId()
2079+
)
20542080
if (
20552081
(response.headers.get(NEXT_BUILD_ID_HEADER) ?? serverData.b) !==
20562082
getAppBuildId()

packages/next/src/server/app-render/app-render.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,10 @@ function maybeAppendBuildIdToRSCPayload<T extends RSCPayload>(
270270
ctx: AppRenderContext,
271271
payload: T
272272
): T {
273+
console.log('maybeAppendBuildIdToRSCPayload', {
274+
dplId: ctx.renderOpts.deploymentId,
275+
buildId: ctx.sharedContext.buildId,
276+
})
273277
if (!ctx.renderOpts.deploymentId) {
274278
// TODO also for output: export, Next.js doesn't control the headers
275279
// for build id, we need to initialize the id on initial page load, so a header isn't enough

test/e2e/app-dir/segment-cache/deployment-skew/next.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ const nextConfig = {
1414
(async () => {
1515
return BUILD_ID
1616
}),
17+
experimental: {
18+
turbopackMinify: false,
19+
turbopackModuleIds: 'named',
20+
turbopackScopeHoisting: false,
21+
},
1722
}
1823

1924
module.exports = nextConfig

0 commit comments

Comments
 (0)