Unverified Commit 645f7012 authored by Thiago Morales's avatar Thiago Morales Committed by GitHub

Pass missing incrementalCacheHandlerPath to IncrementalCache instance (#38433)

# Description
Hi guys! First all, thanks for provide a way to use some custom external cache resource for ISR feature. _(done here: https://github.com/vercel/next.js/pull/37258 and https://github.com/vercel/next.js/pull/37326)_

I managed to get it working by creating my custom external cache resource _(using redis)_ that implements the new `CacheHandler`. _(overriding my own `get` and `set` methods and using the FileSystemCache as fallback as well)_  

I'm planning to release some kind of plugin to encapsulate and parse the client's `next.config.js` and bring an initial support for redis using this new Next.js feature.

So, I really don't know if this was intentional, but I noticed that the new `incrementalCacheHandlerPath` prop wasn't passed to the `IncrementalCache` instance in `base-server`.

This PR just connects the wires for this feature, and also provide the default value (`undefined`) to the relative experimental prop config. _(to avoid the warnings as shown below)_

<img width="858" alt="Screen Shot 2022-07-07 at 19 37 46" src="https://user-images.githubusercontent.com/4661217/177882897-831ade73-26ba-493a-b0cf-3de62cfd708f.png">
parent a622c26d
...@@ -364,6 +364,8 @@ export default abstract class Server<ServerOptions extends Options = Options> { ...@@ -364,6 +364,8 @@ export default abstract class Server<ServerOptions extends Options = Options> {
serverDistDir: this.serverDistDir, serverDistDir: this.serverDistDir,
maxMemoryCacheSize: this.nextConfig.experimental.isrMemoryCacheSize, maxMemoryCacheSize: this.nextConfig.experimental.isrMemoryCacheSize,
flushToDisk: !minimalMode && this.nextConfig.experimental.isrFlushToDisk, flushToDisk: !minimalMode && this.nextConfig.experimental.isrFlushToDisk,
incrementalCacheHandlerPath:
this.nextConfig.experimental?.incrementalCacheHandlerPath,
getPrerenderManifest: () => { getPrerenderManifest: () => {
if (dev) { if (dev) {
return { return {
......
...@@ -534,6 +534,7 @@ export const defaultConfig: NextConfig = { ...@@ -534,6 +534,7 @@ export const defaultConfig: NextConfig = {
appDir: false, appDir: false,
// default to 50MB limit // default to 50MB limit
isrMemoryCacheSize: 50 * 1024 * 1024, isrMemoryCacheSize: 50 * 1024 * 1024,
incrementalCacheHandlerPath: undefined,
serverComponents: false, serverComponents: false,
fullySpecified: false, fullySpecified: false,
outputFileTracingRoot: process.env.NEXT_PRIVATE_OUTPUT_TRACE_ROOT || '', outputFileTracingRoot: process.env.NEXT_PRIVATE_OUTPUT_TRACE_ROOT || '',
......
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