Skip to content

Commit

Permalink
fix: use isOnDemandRevalidate value
Browse files Browse the repository at this point in the history
  • Loading branch information
wyattjoh committed Oct 4, 2023
1 parent 7aec7fa commit ae09439
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/next/src/server/response-cache/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ export default class ResponseCache {
// cache so just return the result of the response generator.
if (!key) return responseGenerator(false, null)

const { incrementalCache } = context
const { incrementalCache, isOnDemandRevalidate = false } = context

return this.batcher.batch(
{ key, isOnDemandRevalidate: false },
{ key, isOnDemandRevalidate },
async (cacheKey, resolve) => {
// We keep the previous cache entry around to leverage when the
// incremental cache is disabled in minimal mode.
Expand All @@ -77,7 +77,7 @@ export default class ResponseCache {
? await incrementalCache.get(key)
: null

if (cachedResponse && !context.isOnDemandRevalidate) {
if (cachedResponse && !isOnDemandRevalidate) {
if (cachedResponse.value?.kind === 'FETCH') {
throw new Error(
`invariant: unexpected cachedResponse of kind fetch in response cache`
Expand Down Expand Up @@ -118,7 +118,7 @@ export default class ResponseCache {

// For on-demand revalidate wait to resolve until cache is set.
// Otherwise resolve now.
if (!context.isOnDemandRevalidate && !resolved) {
if (!isOnDemandRevalidate && !resolved) {
resolve(resolveValue)
resolved = true
}
Expand Down

0 comments on commit ae09439

Please sign in to comment.