Skip to content

Commit

Permalink
Clear prefetch cache after final response is generated
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable committed Oct 25, 2024
1 parent 707ca01 commit 37b8cd1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/next/src/server/base-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3103,9 +3103,15 @@ export default abstract class Server<
)
}

return runWithCacheScope({ cache }, () =>
const response = runWithCacheScope({ cache }, () =>
originalResponseGenerator(state)
)

// Clear the prefetch cache to ensure a clean slate for the next
// request.
this.prefetchCacheScopesDev.del(urlPathname)

return response
}

return originalResponseGenerator(state)
Expand Down

0 comments on commit 37b8cd1

Please sign in to comment.