next.js
4cbfe7d7 - fix incorrect fetch cache handling (#58460)

Commit
2 years ago
fix incorrect fetch cache handling (#58460) ### What? When `FetchCache` is used, cache gets were incorrectly bailing. This would result in unexpected behavior, like continuously revalidating a cache key, as described in #57978. ### Why? #57902 introduced a refactor to the `FileSystemCache` and changed the interface of `get`, but this change was not propagated to `FetchCache`. Specifically, `fetchCache` was removed in favor of a new type `kindHint`. As a result, cache reads would always short circuit because `fetchCache` would never be defined. ### How? This updates the interface on `FetchCache` to match what is defined on the base `CacheHandler`. I've also updated the args to both `get` and `set` to be derived from `CacheHandler` so we don't have any type inconsistencies in the future. I will be following up with a test in the CLI repo to test against a deployed app (since minimalMode cannot be easily mocked in our test suite). Manually verified these changes against the repro in the original issue below, at the following URLs: https://revalidate-vercel-test-iota.vercel.app/fetch-cache-test https://revalidate-vercel-test-iota.vercel.app/revalidate-tag-test Fixes #57978 Fixes #58306
Author
Parents
Loading