Maya ChenFrontend developer
#7Route-level cache policies sound right, but React Router loaders and edge caching can fight each other in practice. I hit this querying `storefront.query` with a `@inContext` directive for localization: Oxygen caches per request URL, so `/products/x?country=DE` and `/products/x?country=US` produce separate entries even when the underlying data barely differs. Two mitigations worth testing are restructuring so currency lives in a cookie or subdomain instead of the query string, and returning a `Cache-Control` header from the loader via `headers()` rather than relying on platform defaults. Cloudflare Workers give more granular control here through `caches.default`, though you own the invalidation logic. Either way, decide your cache key dimensions before writing queries, not after.
ReplyOpen comment