Skip to content

Commit 3914d82

Browse files
committed
fix index page cache interceptor
1 parent 68a13a4 commit 3914d82

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

packages/open-next/src/core/routing/cacheInterceptor.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,22 +146,20 @@ export async function cacheInterceptor(
146146
}
147147
// We also need to remove trailing slash
148148
localizedPath = localizedPath.replace(/\/$/, "");
149-
// If empty path, it means we want index
150-
if (localizedPath === "") {
151-
localizedPath = "index";
152-
}
153149

154150
debug("Checking cache for", localizedPath, PrerenderManifest);
155151

156152
const isISR =
157-
Object.keys(PrerenderManifest.routes).includes(localizedPath) ||
153+
Object.keys(PrerenderManifest.routes).includes(localizedPath ?? "/") ||
158154
Object.values(PrerenderManifest.dynamicRoutes).some((dr) =>
159155
new RegExp(dr.routeRegex).test(localizedPath),
160156
);
161157
debug("isISR", isISR);
162158
if (isISR) {
163159
try {
164-
const cachedData = await globalThis.incrementalCache.get(localizedPath);
160+
const cachedData = await globalThis.incrementalCache.get(
161+
localizedPath ?? "/index",
162+
);
165163
debug("cached data in interceptor", cachedData);
166164

167165
if (!cachedData?.value) {

0 commit comments

Comments
 (0)