Skip to content

Commit

Permalink
fix: switch to definition as cache-key
Browse files Browse the repository at this point in the history
  • Loading branch information
wyattjoh committed Oct 4, 2023
1 parent ae09439 commit 166487c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/next/src/server/dev/on-demand-entry-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,13 @@ export function onDemandEntryHandler({
}

// Make sure that we won't have multiple invalidations ongoing concurrently.
const batcher = Batcher.create<EnsurePageOptions, void, string>({
const batcher = Batcher.create<
Omit<EnsurePageOptions, 'match'> & {
definition?: RouteDefinition
},
void,
string
>({
// The cache key here is composed of the elements that affect the
// compilation, namely, the page, whether it's client only, and whether
// it's an app page. This ensures that we don't have multiple compilations
Expand Down Expand Up @@ -924,7 +930,7 @@ export function onDemandEntryHandler({
// wrapper, which will ensure that we don't have multiple compilations
// for the same page happening concurrently.
return batcher.batch(
{ page, clientOnly, appPaths, match, isApp },
{ page, clientOnly, appPaths, definition: match?.definition, isApp },
async () => {
await ensurePageImpl({ page, clientOnly, appPaths, match, isApp })
}
Expand Down

0 comments on commit 166487c

Please sign in to comment.