Skip to content

Commit

Permalink
disable prefetch aliasing in development (vercel#69168)
Browse files Browse the repository at this point in the history
We don't prefetch in development so the aliasing handling doesn't really
make sense. We still technically create an "auto" prefetch on
navigation, but we'd never benefit from the alias handling because we
wouldn't have prefetched any loading states.
  • Loading branch information
ztanner authored Aug 22, 2024
1 parent 925a3c3 commit afc73d5
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function getExistingCacheEntry(
// but lets us arrive there quicker in the param-full case.
const entryWithoutParams = prefetchCache.get(cacheKeyWithoutParams)
if (
process.env.NODE_ENV !== 'development' &&
url.search &&
kind !== PrefetchKind.FULL &&
entryWithoutParams &&
Expand All @@ -114,7 +115,7 @@ function getExistingCacheEntry(
// We attempt a partial match by checking if there's a cache entry with the same pathname.
// Regardless of what we find, since it doesn't correspond with the requested URL, we'll mark it "aliased".
// This will signal to the router that it should only apply the loading state on the prefetched data.
if (kind !== PrefetchKind.FULL) {
if (process.env.NODE_ENV !== 'development' && kind !== PrefetchKind.FULL) {
for (const cacheEntry of prefetchCache.values()) {
if (
cacheEntry.pathname === url.pathname &&
Expand Down

0 comments on commit afc73d5

Please sign in to comment.