Skip to content

Commit

Permalink
skip flushToDisk in minimal mode for fetch cache
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner committed Nov 16, 2023
1 parent 5f8be1f commit 17c94ec
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
28 changes: 19 additions & 9 deletions packages/next/src/export/helpers/create-incremental-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@ import { IncrementalCache } from '../../server/lib/incremental-cache'
import { hasNextSupport } from '../../telemetry/ci-info'
import { nodeFs } from '../../server/lib/node-fs-methods'

export function createIncrementalCache(
incrementalCacheHandlerPath: string | undefined,
isrMemoryCacheSize: number | undefined,
fetchCacheKeyPrefix: string | undefined,
distDir: string,
dir: string,
enabledDirectories: NextEnabledDirectories,
export function createIncrementalCache({
incrementalCacheHandlerPath,
isrMemoryCacheSize,
fetchCacheKeyPrefix,
distDir,
dir,
enabledDirectories,
experimental,
flushToDisk,
}: {
incrementalCacheHandlerPath?: string
isrMemoryCacheSize?: number
fetchCacheKeyPrefix?: string
distDir: string
dir: string
enabledDirectories: NextEnabledDirectories
experimental: { ppr: boolean }
) {
flushToDisk?: boolean
}) {
// Custom cache handler overrides.
let CacheHandler: any
if (incrementalCacheHandlerPath) {
Expand All @@ -26,7 +36,7 @@ export function createIncrementalCache(
const incrementalCache = new IncrementalCache({
dev: false,
requestHeaders: {},
flushToDisk: true,
flushToDisk,
fetchCache: true,
maxMemoryCacheSize: isrMemoryCacheSize,
fetchCacheKeyPrefix,
Expand Down
9 changes: 6 additions & 3 deletions packages/next/src/export/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,16 +218,19 @@ async function exportPageImpl(
// cache instance for this page.
const incrementalCache =
isAppDir && fetchCache
? createIncrementalCache(
? createIncrementalCache({
incrementalCacheHandlerPath,
isrMemoryCacheSize,
fetchCacheKeyPrefix,
distDir,
dir,
enabledDirectories,
// PPR is not available for Pages.
{ ppr: false }
)
experimental: { ppr: false },
// skip writing to disk in minimal mode for now, pending some
// changes to better support it
flushToDisk: !hasNextSupport,
})
: undefined

// Handle App Routes.
Expand Down

0 comments on commit 17c94ec

Please sign in to comment.