You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: warning fetch for [object Request] specified (#50003)
This PR fixes a warning that previous looked like the following:
```
Warning: fetch for [object Request] specified "cache: default" and "revalidate: 60", only one should be specified.
```
`Warning: fetch for ${input.toString()} specified "cache: ${_cache}" and "revalidate: ${curRevalidate}", only one should be specified.`
177
+
`Warning: fetch for ${fetchUrl} on ${staticGenerationStore.pathname} specified "cache: ${_cache}" and "revalidate: ${curRevalidate}", only one should be specified.`
179
178
)
180
179
_cache=undefined
181
180
}
@@ -219,7 +218,7 @@ export function patchFetch({
219
218
if(isOnlyNoStore){
220
219
if(_cache==='force-cache'||revalidate===0){
221
220
thrownewError(
222
-
`cache: 'force-cache' used on fetch for ${input.toString()} with 'export const fetchCache = 'only-no-store'`
221
+
`cache: 'force-cache' used on fetch for ${fetchUrl} with 'export const fetchCache = 'only-no-store'`
223
222
)
224
223
}
225
224
revalidate=0
@@ -228,7 +227,7 @@ export function patchFetch({
228
227
229
228
if(isOnlyCache&&_cache==='no-store'){
230
229
thrownewError(
231
-
`cache: 'no-store' used on fetch for ${input.toString()} with 'export const fetchCache = 'only-cache'`
230
+
`cache: 'no-store' used on fetch for ${fetchUrl} with 'export const fetchCache = 'only-cache'`
Copy file name to clipboardExpand all lines: test/e2e/app-dir/app-static/app-static.test.ts
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -974,6 +974,12 @@ createNextDescribe(
974
974
975
975
return'success'
976
976
},'success')
977
+
978
+
if(!isNextDeploy){
979
+
expect(next.cliOutput).toContain(
980
+
'Warning: fetch for https://next-data-api-endpoint.vercel.app/api/random?d4 on /force-cache specified "cache: force-cache" and "revalidate: 3", only one should be specified.'
981
+
)
982
+
}
977
983
})
978
984
979
985
it('should cache correctly for cache: no-store',async()=>{
0 commit comments