Skip to content

Commit

Permalink
Revert "Fix: respect init.cache if fetch input is request instance"
Browse files Browse the repository at this point in the history
This reverts commit c523908.
  • Loading branch information
huozhi committed Jan 18, 2024
1 parent c523908 commit eb54e85
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 24 deletions.
3 changes: 1 addition & 2 deletions packages/next/src/server/lib/patch-fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ export function patchFetch({
typeof (input as Request).method === 'string'

const getRequestMeta = (field: string) => {
// If request input is present but init is not, retrieve from input first.
const value = isRequestInput && !init ? (input as any)[field] : null
let value = isRequestInput ? (input as any)[field] : null
return value || (init as any)?.[field]
}

Expand Down
12 changes: 0 additions & 12 deletions test/e2e/app-dir/logging/app/fetch-no-store/page.js

This file was deleted.

10 changes: 0 additions & 10 deletions test/e2e/app-dir/logging/fetch-logging.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,6 @@ createNextDescribe(
expect(output).toContain('Cache missed reason: (noStore call)')
})
})

it('should respect request.init.cache when use with fetch input is instance', async () => {
const logLength = next.cliOutput.length
await next.fetch('/fetch-no-store')

await retry(() => {
const output = stripAnsi(next.cliOutput.slice(logLength))
expect(output).toContain('Cache missed reason: (cache: no-store)')
})
})
}
} else {
// No fetches logging enabled
Expand Down

0 comments on commit eb54e85

Please sign in to comment.