Skip to content

Commit d054cac

Browse files
authored
refactor: remove isRevalidate from work store (#83859)
With the refactor in #83858 there's no longer a reason to distinguish between `isRevalidate` and `isStaticGeneration` and most likely doing so would be a bug, as you'd likely want to apply the same handling to build time generation that you would during a later regeneration. This PR removes `isRevalidate` from the `WorkStore`.
1 parent 8fe8fbc commit d054cac

File tree

12 files changed

+9
-29
lines changed

12 files changed

+9
-29
lines changed

packages/next/src/build/static-paths/app.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,6 @@ export async function buildAppStaticPaths({
828828
incrementalCache,
829829
cacheLifeProfiles,
830830
supportsDynamicResponse: true,
831-
isRevalidate: false,
832831
experimental: {
833832
cacheComponents,
834833
authInterrupts,

packages/next/src/build/templates/app-page.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,6 @@ export async function handler(
539539
)
540540
: `${process.cwd()}/${routeModule.relativeProjectDir}`,
541541
isDraftMode,
542-
isRevalidate: isSSG && !postponed && !isDynamicRSCRequest,
543542
botType,
544543
isOnDemandRevalidate,
545544
isPossibleServerAction,
@@ -566,7 +565,6 @@ export async function handler(
566565
nextExport: true,
567566
supportsDynamicResponse: false,
568567
isStaticGeneration: true,
569-
isRevalidate: true,
570568
isDebugDynamicAccesses: isDebugDynamicAccesses,
571569
}
572570
: {}),
@@ -612,7 +610,6 @@ export async function handler(
612610
if (isDebugStaticShell || isDebugDynamicAccesses) {
613611
context.renderOpts.nextExport = true
614612
context.renderOpts.supportsDynamicResponse = false
615-
context.renderOpts.isRevalidate = true
616613
context.renderOpts.isDebugDynamicAccesses = isDebugDynamicAccesses
617614
}
618615

@@ -1417,7 +1414,7 @@ export async function handler(
14171414
routePath: srcPage,
14181415
routeType: 'render',
14191416
revalidateReason: getRevalidateReason({
1420-
isRevalidate: isSSG,
1417+
isStaticGeneration: isSSG,
14211418
isOnDemandRevalidate,
14221419
}),
14231420
},

packages/next/src/build/templates/app-route.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export async function handler(
162162
// page and it is not being resumed from a postponed render and
163163
// it is not a dynamic RSC request then it is a revalidation
164164
// request.
165-
const isRevalidate = isIsr && !supportsDynamicResponse
165+
const isStaticGeneration = isIsr && !supportsDynamicResponse
166166

167167
// Before rendering (which initializes component tree modules), we have to
168168
// set the reference manifests to our global store so Server Action's
@@ -193,7 +193,6 @@ export async function handler(
193193
supportsDynamicResponse,
194194
incrementalCache: getRequestMeta(req, 'incrementalCache'),
195195
cacheLifeProfiles: nextConfig.experimental?.cacheLife,
196-
isRevalidate,
197196
waitUntil: ctx.waitUntil,
198197
onClose: (cb) => {
199198
res.on('close', cb)
@@ -358,7 +357,7 @@ export async function handler(
358357
routePath: srcPage,
359358
routeType: 'route',
360359
revalidateReason: getRevalidateReason({
361-
isRevalidate,
360+
isStaticGeneration,
362361
isOnDemandRevalidate,
363362
}),
364363
},
@@ -473,7 +472,7 @@ export async function handler(
473472
routePath: normalizedSrcPage,
474473
routeType: 'route',
475474
revalidateReason: getRevalidateReason({
476-
isRevalidate,
475+
isStaticGeneration,
477476
isOnDemandRevalidate,
478477
}),
479478
})

packages/next/src/build/templates/edge-ssr-app.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ async function requestHandler(
138138
dir: pageRouteModule.relativeProjectDir,
139139
botType,
140140
isDraftMode: false,
141-
isRevalidate: false,
142141
isOnDemandRevalidate,
143142
isPossibleServerAction,
144143
assetPrefix: nextConfig.assetPrefix,

packages/next/src/client/components/handle-isr-error.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const workAsyncStorage =
1111
export function HandleISRError({ error }: { error: any }) {
1212
if (workAsyncStorage) {
1313
const store = workAsyncStorage.getStore()
14-
if (store?.isRevalidate || store?.isStaticGeneration) {
14+
if (store?.isStaticGeneration) {
1515
if (error) {
1616
console.error(error)
1717
}

packages/next/src/export/routes/app-route.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import type {
2020
MockedResponse,
2121
} from '../../server/lib/mock-request'
2222
import { isDynamicUsageError } from '../helpers/is-dynamic-usage-error'
23-
import { hasNextSupport } from '../../server/ci-info'
2423
import { isStaticGenEnabled } from '../../server/route-modules/app-route/helpers/is-static-gen-enabled'
2524
import type { ExperimentalConfig } from '../../server/config-shared'
2625
import { isMetadataRoute } from '../../lib/metadata/is-metadata-route'
@@ -94,10 +93,6 @@ export async function exportAppRoute(
9493
},
9594
}
9695

97-
if (hasNextSupport) {
98-
context.renderOpts.isRevalidate = true
99-
}
100-
10196
try {
10297
const userland = module.userland
10398
// we don't bail from the static optimization for

packages/next/src/export/worker.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,6 @@ async function exportPageImpl(
282282
renderResumeDataCache,
283283
}
284284

285-
if (hasNextSupport) {
286-
renderOpts.isRevalidate = true
287-
}
288-
289285
// Handle App Pages
290286
if (isAppDir) {
291287
const sharedContext: AppSharedContext = { buildId }

packages/next/src/server/app-render/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ export interface RenderOptsPartial {
9999
htmlRequestId: string,
100100
requestId: string
101101
) => void
102-
isRevalidate?: boolean
103102
nextExport?: boolean
104103
nextConfigOutput?: 'standalone' | 'export'
105104
onInstrumentationRequestError?: ServerOnInstrumentationRequestError

packages/next/src/server/app-render/work-async-storage.external.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ export interface WorkStore {
3838
*/
3939
readonly hasReadableErrorStacks?: boolean
4040

41-
readonly isRevalidate?: boolean
42-
4341
forceDynamic?: boolean
4442
fetchCache?: AppSegmentConfig['fetchCache']
4543

packages/next/src/server/async-storage/work-store.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ export type WorkStoreContext = {
5454
| 'assetPrefix'
5555
| 'supportsDynamicResponse'
5656
| 'shouldWaitOnAllReady'
57-
| 'isRevalidate'
5857
| 'nextExport'
5958
| 'isDraftMode'
6059
| 'isDebugDynamicAccesses'
@@ -125,7 +124,6 @@ export function createWorkStore({
125124
// so that it can access the fs cache without mocks
126125
renderOpts.incrementalCache || (globalThis as any).__incrementalCache,
127126
cacheLifeProfiles: renderOpts.cacheLifeProfiles,
128-
isRevalidate: renderOpts.isRevalidate,
129127
isBuildTimePrerendering: renderOpts.nextExport,
130128
hasReadableErrorStacks: renderOpts.hasReadableErrorStacks,
131129
fetchCache: renderOpts.fetchCache,

0 commit comments

Comments
 (0)