Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eleven-books-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@opennextjs/aws": patch
---

fix cache interceptor for index page
10 changes: 4 additions & 6 deletions packages/open-next/src/core/routing/cacheInterceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,22 +146,20 @@ export async function cacheInterceptor(
}
// We also need to remove trailing slash
localizedPath = localizedPath.replace(/\/$/, "");
// If empty path, it means we want index
if (localizedPath === "") {
localizedPath = "index";
}

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

const isISR =
Object.keys(PrerenderManifest.routes).includes(localizedPath) ||
Object.keys(PrerenderManifest.routes).includes(localizedPath ?? "/") ||
Object.values(PrerenderManifest.dynamicRoutes).some((dr) =>
new RegExp(dr.routeRegex).test(localizedPath),
);
debug("isISR", isISR);
if (isISR) {
try {
const cachedData = await globalThis.incrementalCache.get(localizedPath);
const cachedData = await globalThis.incrementalCache.get(
localizedPath ?? "/index",
);
debug("cached data in interceptor", cachedData);

if (!cachedData?.value) {
Expand Down
Loading