mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
`x-middleware-cache: "no-store"` in Pages router is a way to signal to the client that it should not store the response in the cache. However in certain circumstances, namely when `unstable_skipClientCache` is true, the data request would be awaited and then stored in the `inflightCache` regardless of the header. The original implementation of this in the router has logic to delete the response from the inflight cache after the request has fulfilled because `inflightCache` stores the unresolved promise. But in this optimistic prefetch case, when we're only storing it in the cache once the request is fulfilled, we can prevent a race condition where the ignored prefetch is erroneously re-added to the cache by ensuring it's never added to the cache to begin with if the response says not to. Fixes #66881 Closes NEXT-3550