question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CDN not working good in preview mode

See original GitHub issue

Is 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
liquefliescommented, Nov 10, 2020

are you saying that I have initialize an additional client and switch on async data based on query string?

1reaction
mornircommented, Nov 9, 2020
  1. 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.

  2. 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).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found