-
Notifications
You must be signed in to change notification settings - Fork 32
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
fix!: make useCdn
use true
by default
#191
Conversation
This is a neat way of preventing some of the unintended cases of hitting the API limits. The semver change seems a bit tricky, but then again, everyone who have been using this with undefined should have seen the warning. It seems unlikely that someone are relying on the undefined behavior for business critical functionality. That being said, what's unclear to me is how we can make sure that the developer experience for folks that use the client to fetch content for static rendering isn't getting more confusing, as well as typical onboarding scenarios, and local development feedback loops. New users and onboardingHow will this affect developers new to the platform who are asked to publish a document and see their change in the frontend? Maybe the cache invalidation is quick enough that it's fine? Either way, we should make sure to make a note of this property in new onboarding materials. DocumentationThis release could incentivize writing better docs on how our caching actually works, including invalidation. I see the "why aren't I'm seeing my published content" quite often. It would also be very helpful if we provided guidance on how to set this property so it works with typical static rendering where builds or frontend revalidation is triggered by a webhook. This also affect content creators who are confused by not seeing their published content. I get that it's slightly outside of this change specifically, but it does bring it into focus. |
To solve the general problem of stale content we could, when publishing a document, show an intermediary "yellow" state: Draft -> Pending/Propagating/Publishing -> Published. For the static site building I think it needs better docs indeed that is tailored specifically for that. There's a lot of moving parts, ISR or no, webhooks or no, etc. |
Added suggested changes from @tarungangwani |
929e07c
to
25fcace
Compare
25fcace
to
73e5767
Compare
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.
While the change in and of itself looks fine, I don't agree that this shouldn't be considered a breaking change. People may have just ignored the warnings on app startup, for instance. I'd vote to bump the major version.
BREAKING CHANGE: if you want to keep the previous behavior, add `useCdn: false` to your configuration. Co-Authored-By: Rune Botten <rbotten@gmail.com>
73e5767
to
2d742b9
Compare
useCdn
use true
by defaultuseCdn
use true
by default
Why
true
is betterSeeing unexpected stale content is a far better problem to have than a surprise overage bill 😅
This is a follow up to this discussion.
Also worth noting that one of the historical reasons why
useCdn: false
have been the default were the limitation the client had prior tov3
: https://www.sanity.io/help/js-client-cdn-configuration#:~:text=subscribing%20to%20changes).-,Gotcha,-Prior%20to%20v3.0.0Now that the client have supported using
token
withuseCdn: true
for quite some time it makes sense to change the default.This will be a breaking release
The release note will highlight this as:
BREAKING CHANGE: if you want to keep the previous behavior, add
useCdn: false
to your configuration.