From 7c6b1a67ade8ef733721189aad609f3804931968 Mon Sep 17 00:00:00 2001 From: "Sebastian \"Sebbie\" Silbermann" Date: Tue, 3 Sep 2024 18:30:38 +0200 Subject: [PATCH] Lazily init fetch dedupe cache (#69492) --- packages/next/src/server/lib/dedupe-fetch.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/next/src/server/lib/dedupe-fetch.ts b/packages/next/src/server/lib/dedupe-fetch.ts index 3b2dc1b30edde..0d893a64d301a 100644 --- a/packages/next/src/server/lib/dedupe-fetch.ts +++ b/packages/next/src/server/lib/dedupe-fetch.ts @@ -3,8 +3,6 @@ */ import * as React from 'react' -// eslint-disable-next-line @typescript-eslint/no-unused-vars -- url is the cache key -const getCacheEntries = React.cache((url: string): Array => []) const simpleCacheKey = '["GET",[],null,"follow",null,null,null,null]' // generateCacheKey(new Request('https://blank')); function generateCacheKey(request: Request): string { @@ -27,6 +25,9 @@ function generateCacheKey(request: Request): string { } export function createDedupeFetch(originalFetch: typeof fetch) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars -- url is the cache key + const getCacheEntries = React.cache((url: string): Array => []) + return function dedupeFetch( resource: URL | RequestInfo, options?: RequestInit