Unverified Commit cc484b99 authored by Wyatt Johnson's avatar Wyatt Johnson Committed by GitHub

refactor: update fallbacks to use response cache (#68603)

This replaces the custom behaviour of `getFallback` in the server with
the existing ResponseCache. This sets us up for #68958 which has
fallbacks that should be revalidatable.
parent 28a5eaa8
...@@ -165,6 +165,7 @@ import { getRevalidateReason } from './instrumentation/utils' ...@@ -165,6 +165,7 @@ import { getRevalidateReason } from './instrumentation/utils'
import { RouteKind } from './route-kind' import { RouteKind } from './route-kind'
import type { RouteModule } from './route-modules/route-module' import type { RouteModule } from './route-modules/route-module'
import { FallbackMode, parseFallbackField } from '../lib/fallback' import { FallbackMode, parseFallbackField } from '../lib/fallback'
import { toResponseCacheEntry } from './response-cache/utils'
export type FindComponentsResult = { export type FindComponentsResult = {
components: LoadComponentsReturnType components: LoadComponentsReturnType
...@@ -378,7 +379,6 @@ export default abstract class Server< ...@@ -378,7 +379,6 @@ export default abstract class Server<
req: ServerRequest, req: ServerRequest,
parsedUrl: NextUrlWithParsedQuery parsedUrl: NextUrlWithParsedQuery
): void ): void
protected abstract getFallback(page: string): Promise<string>
protected abstract hasPage(pathname: string): Promise<boolean> protected abstract hasPage(pathname: string): Promise<boolean>
protected abstract sendRenderResult( protected abstract sendRenderResult(
...@@ -2318,7 +2318,7 @@ export default abstract class Server< ...@@ -2318,7 +2318,7 @@ export default abstract class Server<
} catch {} } catch {}
// use existing incrementalCache instance if available // use existing incrementalCache instance if available
const incrementalCache = const incrementalCache: import('./lib/incremental-cache').IncrementalCache =
(globalThis as any).__incrementalCache || (globalThis as any).__incrementalCache ||
(await this.getIncrementalCache({ (await this.getIncrementalCache({
requestHeaders: Object.assign({}, req.headers), requestHeaders: Object.assign({}, req.headers),
...@@ -2709,11 +2709,11 @@ export default abstract class Server< ...@@ -2709,11 +2709,11 @@ export default abstract class Server<
} }
} }
const responseGenerator: ResponseGenerator = async ( const responseGenerator: ResponseGenerator = async ({
hasResolved, hasResolved,
previousCacheEntry, previousCacheEntry,
isRevalidating isRevalidating,
): Promise<ResponseCacheEntry | null> => { }): Promise<ResponseCacheEntry | null> => {
const isProduction = !this.renderOpts.dev const isProduction = !this.renderOpts.dev
const didRespond = hasResolved || res.sent const didRespond = hasResolved || res.sent
...@@ -2823,37 +2823,51 @@ export default abstract class Server< ...@@ -2823,37 +2823,51 @@ export default abstract class Server<
throw new NoFallbackError() throw new NoFallbackError()
} }
if (!isNextDataRequest) { if (!isNextDataRequest && !isRSCRequest) {
// Production already emitted the fallback as static HTML. const key = isProduction
if (isProduction) { ? isAppPath
const html = await this.getFallback( ? pathname
locale ? `/${locale}${pathname}` : pathname : locale
) ? `/${locale}${pathname}`
: pathname
: null
const fallbackResponse = await this.responseCache.get(
key,
async ({ previousCacheEntry: previousFallbackCacheEntry }) => {
// For the pages router, fallbacks cannot be revalidated or
// generated in production. In the case of a missing fallback,
// we return null, but if it's being revalidated, we just return
// the previous fallback cache entry. This preserves the previous
// behavior.
if (isProduction) {
if (!previousFallbackCacheEntry) {
return null
}
return { return toResponseCacheEntry(previousFallbackCacheEntry)
value: { }
kind: CachedRouteKind.PAGES,
html: RenderResult.fromStatic(html), query.__nextFallback = 'true'
pageData: {},
status: undefined, // We pass `undefined` as rendering a fallback isn't resumed here.
headers: undefined, return doRender({ postponed: undefined })
}, },
} {
} routeKind: isAppPath ? RouteKind.APP_PAGE : RouteKind.PAGES,
// We need to generate the fallback on-demand for development. incrementalCache,
else { isRoutePPREnabled,
query.__nextFallback = 'true' isFallback: true,
// We pass `undefined` as there cannot be a postponed state in
// development.
const result = await doRender({ postponed: undefined })
if (!result) {
return null
} }
// Prevent caching this result )
delete result.revalidate
return result if (!fallbackResponse) return null
}
// Remove the revalidate from the response to prevent it from being
// used in the surrounding cache.
delete fallbackResponse.revalidate
return fallbackResponse
} }
} }
...@@ -2910,6 +2924,7 @@ export default abstract class Server< ...@@ -2910,6 +2924,7 @@ export default abstract class Server<
isOnDemandRevalidate, isOnDemandRevalidate,
isPrefetch: req.headers.purpose === 'prefetch', isPrefetch: req.headers.purpose === 'prefetch',
isRoutePPREnabled, isRoutePPREnabled,
isFallback: false,
} }
) )
......
...@@ -174,7 +174,7 @@ export default class FileSystemCache implements CacheHandler { ...@@ -174,7 +174,7 @@ export default class FileSystemCache implements CacheHandler {
public async get(...args: Parameters<CacheHandler['get']>) { public async get(...args: Parameters<CacheHandler['get']>) {
const [key, ctx] = args const [key, ctx] = args
const { tags, softTags, kind, isRoutePPREnabled } = ctx const { tags, softTags, kind, isRoutePPREnabled, isFallback } = ctx
let data = memoryCache?.get(key) let data = memoryCache?.get(key)
...@@ -252,24 +252,27 @@ export default class FileSystemCache implements CacheHandler { ...@@ -252,24 +252,27 @@ export default class FileSystemCache implements CacheHandler {
} }
} else if (kind === IncrementalCacheKind.APP_PAGE) { } else if (kind === IncrementalCacheKind.APP_PAGE) {
let meta: RouteMetadata | undefined let meta: RouteMetadata | undefined
let rscData: Buffer | undefined
// We try to load the metadata file, but if it fails, we don't // We try to load the metadata file, but if it fails, we don't
// error. // error. We also don't load it if this is a fallback.
try { if (!isFallback) {
meta = JSON.parse( try {
await this.fs.readFile( meta = JSON.parse(
filePath.replace(/\.html$/, NEXT_META_SUFFIX), await this.fs.readFile(
'utf8' filePath.replace(/\.html$/, NEXT_META_SUFFIX),
'utf8'
)
) )
) } catch {}
} catch {}
const rscData = await this.fs.readFile( rscData = await this.fs.readFile(
this.getFilePath( this.getFilePath(
`${key}${isRoutePPREnabled ? RSC_PREFETCH_SUFFIX : RSC_SUFFIX}`, `${key}${isRoutePPREnabled ? RSC_PREFETCH_SUFFIX : RSC_SUFFIX}`,
IncrementalCacheKind.APP_PAGE IncrementalCacheKind.APP_PAGE
)
) )
) }
data = { data = {
lastModified: mtime.getTime(), lastModified: mtime.getTime(),
...@@ -284,16 +287,19 @@ export default class FileSystemCache implements CacheHandler { ...@@ -284,16 +287,19 @@ export default class FileSystemCache implements CacheHandler {
} }
} else if (kind === IncrementalCacheKind.PAGES) { } else if (kind === IncrementalCacheKind.PAGES) {
let meta: RouteMetadata | undefined let meta: RouteMetadata | undefined
let pageData: string | object = {}
const pageData = JSON.parse( if (!isFallback) {
await this.fs.readFile( pageData = JSON.parse(
this.getFilePath( await this.fs.readFile(
`${key}${NEXT_DATA_SUFFIX}`, this.getFilePath(
IncrementalCacheKind.PAGES `${key}${NEXT_DATA_SUFFIX}`,
), IncrementalCacheKind.PAGES
'utf8' ),
'utf8'
)
) )
) }
data = { data = {
lastModified: mtime.getTime(), lastModified: mtime.getTime(),
...@@ -376,6 +382,7 @@ export default class FileSystemCache implements CacheHandler { ...@@ -376,6 +382,7 @@ export default class FileSystemCache implements CacheHandler {
public async set(...args: Parameters<CacheHandler['set']>) { public async set(...args: Parameters<CacheHandler['set']>) {
const [key, data, ctx] = args const [key, data, ctx] = args
const { isFallback } = ctx
memoryCache?.set(key, { memoryCache?.set(key, {
value: data, value: data,
lastModified: Date.now(), lastModified: Date.now(),
...@@ -417,25 +424,30 @@ export default class FileSystemCache implements CacheHandler { ...@@ -417,25 +424,30 @@ export default class FileSystemCache implements CacheHandler {
await this.fs.mkdir(path.dirname(htmlPath)) await this.fs.mkdir(path.dirname(htmlPath))
await this.fs.writeFile(htmlPath, data.html) await this.fs.writeFile(htmlPath, data.html)
await this.fs.writeFile( // Fallbacks don't generate a data file.
this.getFilePath( if (!isFallback) {
`${key}${ await this.fs.writeFile(
this.getFilePath(
`${key}${
isAppPath
? ctx.isRoutePPREnabled
? RSC_PREFETCH_SUFFIX
: RSC_SUFFIX
: NEXT_DATA_SUFFIX
}`,
isAppPath isAppPath
? ctx.isRoutePPREnabled ? IncrementalCacheKind.APP_PAGE
? RSC_PREFETCH_SUFFIX : IncrementalCacheKind.PAGES
: RSC_SUFFIX ),
: NEXT_DATA_SUFFIX isAppPath ? data.rscData : JSON.stringify(data.pageData)
}`, )
isAppPath ? IncrementalCacheKind.APP_PAGE : IncrementalCacheKind.PAGES }
),
isAppPath ? data.rscData : JSON.stringify(data.pageData)
)
if (data.headers || data.status || (isAppPath && data.postponed)) { if (data?.kind === CachedRouteKind.APP_PAGE) {
const meta: RouteMetadata = { const meta: RouteMetadata = {
headers: data.headers, headers: data.headers,
status: data.status, status: data.status,
postponed: isAppPath ? data.postponed : undefined, postponed: data.postponed,
} }
await this.fs.writeFile( await this.fs.writeFile(
......
...@@ -190,16 +190,17 @@ export class IncrementalCache implements IncrementalCacheType { ...@@ -190,16 +190,17 @@ export class IncrementalCache implements IncrementalCacheType {
private calculateRevalidate( private calculateRevalidate(
pathname: string, pathname: string,
fromTime: number, fromTime: number,
dev?: boolean dev: boolean,
isFallback: boolean | undefined
): Revalidate { ): Revalidate {
// in development we don't have a prerender-manifest // in development we don't have a prerender-manifest
// and default to always revalidating to allow easier debugging // and default to always revalidating to allow easier debugging
if (dev) return new Date().getTime() - 1000 if (dev) return new Date().getTime() - 1000
// if an entry isn't present in routes we fallback to a default // if an entry isn't present in routes we fallback to a default
// of revalidating after 1 second. // of revalidating after 1 second unless it's a fallback request.
const initialRevalidateSeconds = const initialRevalidateSeconds =
this.revalidateTimings.get(toRoute(pathname)) ?? 1 this.revalidateTimings.get(toRoute(pathname)) ?? (isFallback ? false : 1)
const revalidateAfter = const revalidateAfter =
typeof initialRevalidateSeconds === 'number' typeof initialRevalidateSeconds === 'number'
...@@ -384,6 +385,7 @@ export class IncrementalCache implements IncrementalCacheType { ...@@ -384,6 +385,7 @@ export class IncrementalCache implements IncrementalCacheType {
tags?: string[] tags?: string[]
softTags?: string[] softTags?: string[]
isRoutePPREnabled?: boolean isRoutePPREnabled?: boolean
isFallback: boolean | undefined
} }
): Promise<IncrementalCacheEntry | null> { ): Promise<IncrementalCacheEntry | null> {
// we don't leverage the prerender cache in dev mode // we don't leverage the prerender cache in dev mode
...@@ -446,7 +448,8 @@ export class IncrementalCache implements IncrementalCacheType { ...@@ -446,7 +448,8 @@ export class IncrementalCache implements IncrementalCacheType {
revalidateAfter = this.calculateRevalidate( revalidateAfter = this.calculateRevalidate(
cacheKey, cacheKey,
cacheData?.lastModified || Date.now(), cacheData?.lastModified || Date.now(),
this.dev && ctx.kind !== IncrementalCacheKind.FETCH this.dev ? ctx.kind !== IncrementalCacheKind.FETCH : false,
ctx.isFallback
) )
isStale = isStale =
revalidateAfter !== false && revalidateAfter < Date.now() revalidateAfter !== false && revalidateAfter < Date.now()
...@@ -494,6 +497,7 @@ export class IncrementalCache implements IncrementalCacheType { ...@@ -494,6 +497,7 @@ export class IncrementalCache implements IncrementalCacheType {
fetchIdx?: number fetchIdx?: number
tags?: string[] tags?: string[]
isRoutePPREnabled?: boolean isRoutePPREnabled?: boolean
isFallback?: boolean
} }
) { ) {
if (this.disableForTestmode || (this.dev && !ctx.fetchCache)) return if (this.disableForTestmode || (this.dev && !ctx.fetchCache)) return
......
...@@ -676,6 +676,7 @@ export function createPatchedFetcher( ...@@ -676,6 +676,7 @@ export function createPatchedFetcher(
fetchIdx, fetchIdx,
tags, tags,
softTags: implicitTags, softTags: implicitTags,
isFallback: false,
}) })
if (entry) { if (entry) {
......
...@@ -797,15 +797,6 @@ export default class NextNodeServer extends BaseServer< ...@@ -797,15 +797,6 @@ export default class NextNodeServer extends BaseServer<
) as NextFontManifest ) as NextFontManifest
} }
protected getFallback(page: string): Promise<string> {
page = normalizePagePath(page)
const cacheFs = this.getCacheFilesystem()
return cacheFs.readFile(
join(this.serverDistDir, 'pages', `${page}.html`),
'utf8'
)
}
protected handleNextImageRequest: NodeRouteHandler = async ( protected handleNextImageRequest: NodeRouteHandler = async (
req, req,
res, res,
...@@ -887,6 +878,7 @@ export default class NextNodeServer extends BaseServer< ...@@ -887,6 +878,7 @@ export default class NextNodeServer extends BaseServer<
{ {
routeKind: RouteKind.IMAGE, routeKind: RouteKind.IMAGE,
incrementalCache: imageOptimizerCache, incrementalCache: imageOptimizerCache,
isFallback: false,
} }
) )
......
...@@ -58,13 +58,21 @@ export default class ResponseCache implements ResponseCacheBase { ...@@ -58,13 +58,21 @@ export default class ResponseCache implements ResponseCacheBase {
isPrefetch?: boolean isPrefetch?: boolean
incrementalCache: IncrementalCache incrementalCache: IncrementalCache
isRoutePPREnabled?: boolean isRoutePPREnabled?: boolean
isFallback: boolean
} }
): Promise<ResponseCacheEntry | null> { ): Promise<ResponseCacheEntry | null> {
// If there is no key for the cache, we can't possibly look this up in the // If there is no key for the cache, we can't possibly look this up in the
// cache so just return the result of the response generator. // cache so just return the result of the response generator.
if (!key) return responseGenerator(false, null) if (!key) {
return responseGenerator({ hasResolved: false, previousCacheEntry: null })
}
const { incrementalCache, isOnDemandRevalidate = false } = context const {
incrementalCache,
isOnDemandRevalidate = false,
isFallback = false,
isRoutePPREnabled = false,
} = context
const response = await this.batcher.batch( const response = await this.batcher.batch(
{ key, isOnDemandRevalidate }, { key, isOnDemandRevalidate },
...@@ -89,6 +97,7 @@ export default class ResponseCache implements ResponseCacheBase { ...@@ -89,6 +97,7 @@ export default class ResponseCache implements ResponseCacheBase {
? await incrementalCache.get(key, { ? await incrementalCache.get(key, {
kind, kind,
isRoutePPREnabled: context.isRoutePPREnabled, isRoutePPREnabled: context.isRoutePPREnabled,
isFallback,
}) })
: null : null
...@@ -112,11 +121,11 @@ export default class ResponseCache implements ResponseCacheBase { ...@@ -112,11 +121,11 @@ export default class ResponseCache implements ResponseCacheBase {
} }
} }
const cacheEntry = await responseGenerator( const cacheEntry = await responseGenerator({
resolved, hasResolved: resolved,
cachedResponse, previousCacheEntry: cachedResponse,
true isRevalidating: true,
) })
// If the cache entry couldn't be generated, we don't want to cache // If the cache entry couldn't be generated, we don't want to cache
// the result. // the result.
...@@ -143,6 +152,8 @@ export default class ResponseCache implements ResponseCacheBase { ...@@ -143,6 +152,8 @@ export default class ResponseCache implements ResponseCacheBase {
resolved = true resolved = true
} }
// We want to persist the result only if it has a revalidate value
// defined.
if (typeof resolveValue.revalidate !== 'undefined') { if (typeof resolveValue.revalidate !== 'undefined') {
if (this.minimalMode) { if (this.minimalMode) {
this.previousCacheItem = { this.previousCacheItem = {
...@@ -153,7 +164,8 @@ export default class ResponseCache implements ResponseCacheBase { ...@@ -153,7 +164,8 @@ export default class ResponseCache implements ResponseCacheBase {
} else { } else {
await incrementalCache.set(key, resolveValue.value, { await incrementalCache.set(key, resolveValue.value, {
revalidate: resolveValue.revalidate, revalidate: resolveValue.revalidate,
isRoutePPREnabled: context.isRoutePPREnabled, isRoutePPREnabled,
isFallback,
}) })
} }
} }
...@@ -168,7 +180,8 @@ export default class ResponseCache implements ResponseCacheBase { ...@@ -168,7 +180,8 @@ export default class ResponseCache implements ResponseCacheBase {
Math.max(cachedResponse.revalidate || 3, 3), Math.max(cachedResponse.revalidate || 3, 3),
30 30
), ),
isRoutePPREnabled: context.isRoutePPREnabled, isRoutePPREnabled,
isFallback,
}) })
} }
......
...@@ -18,6 +18,14 @@ export interface ResponseCacheBase { ...@@ -18,6 +18,14 @@ export interface ResponseCacheBase {
*/ */
routeKind: RouteKind routeKind: RouteKind
/**
* True if this is a fallback request.
*/
isFallback: boolean
/**
* True if the route is enabled for PPR.
*/
isRoutePPREnabled?: boolean isRoutePPREnabled?: boolean
} }
): Promise<ResponseCacheEntry | null> ): Promise<ResponseCacheEntry | null>
...@@ -155,11 +163,11 @@ export type ResponseCacheEntry = { ...@@ -155,11 +163,11 @@ export type ResponseCacheEntry = {
* @param hasResolved whether the responseGenerator has resolved it's promise * @param hasResolved whether the responseGenerator has resolved it's promise
* @param previousCacheEntry the previous cache entry if it exists or the current * @param previousCacheEntry the previous cache entry if it exists or the current
*/ */
export type ResponseGenerator = ( export type ResponseGenerator = (state: {
hasResolved: boolean, hasResolved: boolean
previousCacheEntry?: IncrementalCacheItem, previousCacheEntry?: IncrementalCacheItem
isRevalidating?: boolean isRevalidating?: boolean
) => Promise<ResponseCacheEntry | null> }) => Promise<ResponseCacheEntry | null>
export type IncrementalCacheItem = { export type IncrementalCacheItem = {
revalidateAfter?: number | false revalidateAfter?: number | false
...@@ -184,7 +192,15 @@ export interface IncrementalCache { ...@@ -184,7 +192,15 @@ export interface IncrementalCache {
ctx: { ctx: {
kind: IncrementalCacheKind kind: IncrementalCacheKind
/**
* True if the route is enabled for PPR.
*/
isRoutePPREnabled?: boolean isRoutePPREnabled?: boolean
/**
* True if this is a fallback request.
*/
isFallback: boolean
} }
) => Promise<IncrementalCacheItem> ) => Promise<IncrementalCacheItem>
set: ( set: (
...@@ -192,7 +208,16 @@ export interface IncrementalCache { ...@@ -192,7 +208,16 @@ export interface IncrementalCache {
data: IncrementalCacheValue | null, data: IncrementalCacheValue | null,
ctx: { ctx: {
revalidate: Revalidate revalidate: Revalidate
/**
* True if the route is enabled for PPR.
*/
isRoutePPREnabled?: boolean isRoutePPREnabled?: boolean
/**
* True if this is a fallback request.
*/
isFallback: boolean
} }
) => Promise<void> ) => Promise<void>
} }
...@@ -51,7 +51,7 @@ export default class WebResponseCache { ...@@ -51,7 +51,7 @@ export default class WebResponseCache {
this.pendingResponses.set(pendingResponseKey, promise) this.pendingResponses.set(pendingResponseKey, promise)
} }
let resolved = false let hasResolved = false
const resolve = (cacheEntry: ResponseCacheEntry | null) => { const resolve = (cacheEntry: ResponseCacheEntry | null) => {
if (pendingResponseKey) { if (pendingResponseKey) {
// Ensure all reads from the cache get the latest value. // Ensure all reads from the cache get the latest value.
...@@ -60,8 +60,8 @@ export default class WebResponseCache { ...@@ -60,8 +60,8 @@ export default class WebResponseCache {
Promise.resolve(cacheEntry) Promise.resolve(cacheEntry)
) )
} }
if (!resolved) { if (!hasResolved) {
resolved = true hasResolved = true
resolver(cacheEntry) resolver(cacheEntry)
} }
} }
...@@ -84,7 +84,7 @@ export default class WebResponseCache { ...@@ -84,7 +84,7 @@ export default class WebResponseCache {
// same promise until we've fully finished our work. // same promise until we've fully finished our work.
;(async () => { ;(async () => {
try { try {
const cacheEntry = await responseGenerator(resolved) const cacheEntry = await responseGenerator({ hasResolved })
const resolveValue = const resolveValue =
cacheEntry === null cacheEntry === null
? null ? null
...@@ -114,7 +114,7 @@ export default class WebResponseCache { ...@@ -114,7 +114,7 @@ export default class WebResponseCache {
} catch (err) { } catch (err) {
// while revalidating in the background we can't reject as // while revalidating in the background we can't reject as
// we already resolved the cache entry so log the error here // we already resolved the cache entry so log the error here
if (resolved) { if (hasResolved) {
console.error(err) console.error(err)
} else { } else {
rejecter(err as Error) rejecter(err as Error)
......
...@@ -355,10 +355,6 @@ export default class NextWebServer extends BaseServer< ...@@ -355,10 +355,6 @@ export default class NextWebServer extends BaseServer<
return false return false
} }
protected async getFallback() {
return ''
}
protected getFontManifest() { protected getFontManifest() {
return undefined return undefined
} }
......
...@@ -196,6 +196,7 @@ export function unstable_cache<T extends Callback>( ...@@ -196,6 +196,7 @@ export function unstable_cache<T extends Callback>(
softTags: implicitTags, softTags: implicitTags,
fetchIdx, fetchIdx,
fetchUrl, fetchUrl,
isFallback: false,
}) })
if (cacheEntry && cacheEntry.value) { if (cacheEntry && cacheEntry.value) {
...@@ -309,6 +310,7 @@ export function unstable_cache<T extends Callback>( ...@@ -309,6 +310,7 @@ export function unstable_cache<T extends Callback>(
fetchIdx, fetchIdx,
fetchUrl, fetchUrl,
softTags: implicitTags, softTags: implicitTags,
isFallback: false,
}) })
if (cacheEntry && cacheEntry.value) { if (cacheEntry && cacheEntry.value) {
......
...@@ -186,7 +186,7 @@ describe('ppr-full', () => { ...@@ -186,7 +186,7 @@ describe('ppr-full', () => {
} }
}) })
if (dynamic === true) { if (dynamic === true && !isNextDev) {
it('should cache the static part', async () => { it('should cache the static part', async () => {
const delay = 500 const delay = 500
......
...@@ -40,6 +40,7 @@ describe('FileSystemCache', () => { ...@@ -40,6 +40,7 @@ describe('FileSystemCache', () => {
( (
await fsCache.get('icon.png', { await fsCache.get('icon.png', {
kind: IncrementalCacheKind.APP_ROUTE, kind: IncrementalCacheKind.APP_ROUTE,
isFallback: undefined,
}) })
)?.value )?.value
).toEqual({ ).toEqual({
...@@ -88,6 +89,7 @@ describe('FileSystemCache (isrMemory 0)', () => { ...@@ -88,6 +89,7 @@ describe('FileSystemCache (isrMemory 0)', () => {
const res = await fsCache.get('fetch-cache', { const res = await fsCache.get('fetch-cache', {
tags: ['server-time'], tags: ['server-time'],
kind: IncrementalCacheKind.FETCH, kind: IncrementalCacheKind.FETCH,
isFallback: undefined,
}) })
expect(res?.value).toEqual({ expect(res?.value).toEqual({
...@@ -117,6 +119,7 @@ describe('FileSystemCache (isrMemory 0)', () => { ...@@ -117,6 +119,7 @@ describe('FileSystemCache (isrMemory 0)', () => {
const res = await fsCache.get('unstable-cache', { const res = await fsCache.get('unstable-cache', {
tags: ['server-time'], tags: ['server-time'],
kind: IncrementalCacheKind.FETCH, kind: IncrementalCacheKind.FETCH,
isFallback: undefined,
}) })
expect(res?.value).toEqual({ expect(res?.value).toEqual({
......
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