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
We are using Laravel Precognition feature to validate forms server-side before we actually submit them.
By default we use useFetch, and simply add the header required by this feature to perform the validation instead of the actual request.
Since useFetch deduplicates identical requests by default, our validation request is actually the request that gets cached. This means that when we actually want to make the request, we just get our cached response back instantly, which does not actually do anything.
Ha! This now triggers cache-misses when setting headers with useRequestHeaders, which only populates the headers on server-side, but not client-side: #23900
Describe the feature
We are using Laravel Precognition feature to validate forms server-side before we actually submit them.
By default we use useFetch, and simply add the header required by this feature to perform the validation instead of the actual request.
Since useFetch deduplicates identical requests by default, our validation request is actually the request that gets cached. This means that when we actually want to make the request, we just get our cached response back instantly, which does not actually do anything.
We traced this down to this line
nuxt/packages/nuxt/src/app/composables/fetch.ts
Line 88 in 876fa7f
Since we don't actually change the body, url, or params, the cache is hit.
I think it would be sensible to also include the headers in the caching key.
Additional information
Final checks
The text was updated successfully, but these errors were encountered: