-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support sub request cache control header stale-while-revalidate
everywhere
#1049
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super cool fix! As mentioned in the comments, I think we should remove forked logic for Cloudflare and instead behave this way for all runtimes.
stale-while-revalidate
everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Amazing work!
@@ -17,7 +17,7 @@ export class InMemoryCache { | |||
} | |||
|
|||
put(request: Request, response: Response) { | |||
logCacheApiStatus('PUT', request.url); | |||
logCacheApiStatus('PUT-dev', request.url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll be using this in production soon Shopify/hydrogen#977 do we need the -dev
suffixes? Not a blocker — we can address in a future PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I put the -dev
suffixes is because this in-memory
cache can only be turned on if devCache
is turn on. I want it to be obvious that it is a cache for development purpose and not for production purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave it for now and address in that future PR
Co-authored-by: Michelle Vinci <[email protected]>
* v1.x-2022-07: [Hydrogen docs]: Analytics (#962) Analytics (#890) Allow line breaks inside script tags (#1061) Fix encoding of CSS Modules to solve hydration errors (#1062) [Hydrogen docs]: Update guidance on troubleshooting third-party dependencies (#1055) Update Vite RSC Plugin (#1054) Fix link prefetch (#1059) Initial devTools component (#998) Support sub request cache control header `stale-while-revalidate` everywhere (#1049) Fix cookie parsing (#1046) Update 3-external-images-with-a-custom-loader.example.tsx (#1045) Restore scroll position on browser navigation (#1047) Remove old changeset to unblock release (#1042) [ci] release v1.x-2022-07 (#1019) Update to Vite 2.9 (#1039) Use lang directive (#1028)
Fix: https://github.com/Shopify/custom-storefronts/issues/175
Description
This is a workaround for supporting
stale-while-revalidate
cache controlon CloudflareeverywhereHow to test on Cloudflare
You must have:
worker.dev
that Cloudflare gives you)Once you have satisfy the above requirements, you can deploy your app with
setLoggerOptions({showCacheApiStatus: true})
andwrangler tail -f pretty
to see the cache api logs.Before submitting the PR, please make sure you do the following:
fixes #123
)yarn changeset add
if this PR cause a version bump based on Keep a Changelog and adheres to Semantic Versioning