Skip to content

Commit

Permalink
Lazily init fetch dedupe cache (#69492)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored Sep 3, 2024
1 parent 3ff93d9 commit 7c6b1a6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/next/src/server/lib/dedupe-fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any> => [])
const simpleCacheKey = '["GET",[],null,"follow",null,null,null,null]' // generateCacheKey(new Request('https://blank'));

function generateCacheKey(request: Request): string {
Expand All @@ -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<any> => [])

return function dedupeFetch(
resource: URL | RequestInfo,
options?: RequestInit
Expand Down

0 comments on commit 7c6b1a6

Please sign in to comment.