CDN not working good in preview mode
See original GitHub issueIs your feature request related to a problem? Please describe.
When I use nuxt preview mode, the client will refresh data with cdn API and data is not refreshed.
Describe the solution you’d like to see
I noticed that there is no way to invalidate cdn api / or change it’s endpoint (from cdnUrl to hostUrl) when is into preview mode.
Describe alternatives you’ve considered
How about invalidate cache or switch to no-cdn mode when preview=true
?
Here to help,
L.
EDIT:
an idea could be adding a parameter to fetch that can define if we are in preview or not
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (9 by maintainers)
Top Results From Across the Web
CDN not working good in preview mode · Issue #45 - GitHub
When I use nuxt preview mode, the client will refresh data with cdn API and data is not refreshed. Describe the solution you'd...
Read more >Embedded CDN Javascript code not showing in Preview mode
I am seeing the correct output on the build page but the moment I go to preview it does not show up. It...
Read more >CDN Troubleshooting Guide - KeyCDN Support
Check out our CDN troubleshooting guide to find answers, guides and tools to help you resolve common troubleshooting issues.
Read more >CDN + Content Area Was Not Found - WordPress.org
Hello Guys, have you hear about CDN like Cloudflare and Elementor problem to edit the first page ? After i used Cloudflare i...
Read more >Advanced Features: Preview Mode | Next.js
js has a feature called Preview Mode which solves this problem. Here are instructions on how to use it. Step 1. Create and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
are you saying that I have initialize an additional client and switch on async data based on query string?
If you’re generating all your routes at build time, you shouldn’t use Sanity’s CDN. When content editors trigger a new build from the Studio, you always want the freshest data. And in production, the users won’t hit the CDN because all the content is pre-generated.
You can initialize a second client with the appropriate config (no cdn, withCredentials). In the preview plugin, you can use that client to fetch the data and then pass that data to
enablePreview()
. (https://nuxtjs.org/docs/2.x/features/live-preview/#passing-data-to-enablepreview).