File tree 3 files changed +25
-2
lines changed
packages/next/src/server/lib
3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -236,8 +236,9 @@ export function patchFetch({
236
236
typeof ( input as Request ) . method === 'string'
237
237
238
238
const getRequestMeta = ( field : string ) => {
239
- let value = isRequestInput ? ( input as any ) [ field ] : null
240
- return value || ( init as any ) ?. [ field ]
239
+ // If request input is present but init is not, retrieve from input first.
240
+ const value = ( init as any ) ?. [ field ]
241
+ return value || ( isRequestInput ? ( input as any ) [ field ] : null )
241
242
}
242
243
243
244
// If the staticGenerationStore is not available, we can't do any
Original file line number Diff line number Diff line change
1
+ export default async function Page ( ) {
2
+ await fetch (
3
+ new Request (
4
+ 'https://next-data-api-endpoint.vercel.app/api/random?request-input'
5
+ ) ,
6
+ {
7
+ cache : 'no-store' ,
8
+ }
9
+ )
10
+
11
+ return < div > Hello World!</ div >
12
+ }
Original file line number Diff line number Diff line change @@ -141,6 +141,16 @@ createNextDescribe(
141
141
expect ( output ) . toContain ( 'Cache missed reason: (noStore call)' )
142
142
} )
143
143
} )
144
+
145
+ it ( 'should respect request.init.cache when use with fetch input is instance' , async ( ) => {
146
+ const logLength = next . cliOutput . length
147
+ await next . fetch ( '/fetch-no-store' )
148
+
149
+ await retry ( ( ) => {
150
+ const output = stripAnsi ( next . cliOutput . slice ( logLength ) )
151
+ expect ( output ) . toContain ( 'Cache missed reason: (cache: no-store)' )
152
+ } )
153
+ } )
144
154
}
145
155
} else {
146
156
// No fetches logging enabled
You can’t perform that action at this time.
0 commit comments