Skip to content

Commit

Permalink
apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Sep 26, 2024
1 parent b7f6dac commit 5f75217
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion packages/next/src/server/async-storage/cache-scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export function runWithCacheScope(
) {
return cacheScopeAsyncLocalStorage.run(
{
...store,
cache: store.cache || new Map(),
},
fn
Expand Down
10 changes: 5 additions & 5 deletions packages/next/src/server/base-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ export default abstract class Server<

private readonly isAppPPREnabled: boolean

private readonly prefetchCacheScopes = new PrefetchCacheScopes()
private readonly prefetchCacheScopesDev = new PrefetchCacheScopes()

/**
* This is used to persist cache scopes across
Expand Down Expand Up @@ -3013,7 +3013,7 @@ export default abstract class Server<
let cache: CacheScopeStore['cache'] | undefined

if (this.renderOpts.dev) {
cache = this.prefetchCacheScopes.get(urlPathname)
cache = this.prefetchCacheScopesDev.get(urlPathname)

// we need to seed the prefetch cache scope in dev
// since we did not have a prefetch cache available
Expand All @@ -3031,7 +3031,7 @@ export default abstract class Server<
await runWithCacheScope({ cache }, () =>
originalResponseGenerator(...args)
)
this.prefetchCacheScopes.set(urlPathname, cache)
this.prefetchCacheScopesDev.set(urlPathname, cache)

delete req.headers[RSC_HEADER]
delete req.headers[NEXT_ROUTER_PREFETCH_HEADER]
Expand All @@ -3043,9 +3043,9 @@ export default abstract class Server<
).finally(() => {
if (this.renderOpts.dev) {
if (isPrefetchRSCRequest) {
this.prefetchCacheScopes.set(urlPathname, cache)
this.prefetchCacheScopesDev.set(urlPathname, cache)
} else {
this.prefetchCacheScopes.del(urlPathname)
this.prefetchCacheScopesDev.del(urlPathname)
}
}
})
Expand Down

0 comments on commit 5f75217

Please sign in to comment.