Add Incremental Static Regeneration support for the Netlify's on-demand builders#7975
Add Incremental Static Regeneration support for the Netlify's on-demand builders#7975
Conversation
🦋 Changeset detectedLatest commit: e51d701 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
ematipico
left a comment
There was a problem hiding this comment.
locals in an Astro component are read-only properties and you won't be able to set anything like this. The only place where you can write stuff in the locals is inside the middleware.
Ah, that is a very important limitation of this API! Should we use a |
|
@ematipico It works. Do you mean it should be read-only? |
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
|
There is no official word of this outside of Netlify's API reference, but most of on-demand builders' functionality has been brought into other functions. I found this out from a Netlify support thread, and the gist of it is, its use case has become niche: single cache store used globally - instead of per-region, as it is for normal and edge functions. This PR could still be merged for feature-completeness. I will be updating the Netlify part of the ISR guide to use |
Yes.
We don't use |
|
@ematipico Considering that serializability restrictions are relaxed, maybe a ---
Astro.locals.netlify.builders.setTtl(45)
---
<h1>Astro</h1> |
Yeah that's way better I'd say |
|
I would like a pointer for adding a no-op for dev. I see dev mode support was added in #7385, but the two tests added in it are for build. |
Yeah, the PR title is misleading (it was picked up from a third-party contributor). I am not sure how we can fix this case, with the code we have now. I think Astro should provide a safe way to retrieve the "adapter runtime", and if the adapter doesn't provide any runtime, it should be undefined. E.g. const runtime = Astro.locals.getAdapterRuntime();
if (runtime) {
runtime.setBuilderTtl(45)
}The downside is that these kinds of things are only visible when building the project and deploying it. |
|
Should I add a |
ElianCodes
left a comment
There was a problem hiding this comment.
A couple of small changes, but after applying, good to go!
Co-authored-by: Elian ☕️ <hello@elian.codes>
Co-authored-by: Elian ☕️ <hello@elian.codes>
…nd builders adapter (#7975) * feat(netlify): expose builders ttl as a local * add changeset * docs(netlify): caching using on-demand builders * reword readme section * Update packages/integrations/netlify/package.json Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> * include builders-types.d.ts in the distribution * document caveat regarding query params * update changeset * mutation -> function * locals.netlify -> locals.runtime * update types and changeset * Apply suggestions from code review Co-authored-by: Elian ☕️ <hello@elian.codes> * Apply suggestions from code review Co-authored-by: Elian ☕️ <hello@elian.codes> --------- Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> Co-authored-by: Elian ☕️ <hello@elian.codes>
Changes
Testing
Added a fixture

Docs
Added to the package README
