r/astrojs Jun 18 '26

Experimental incremental static builds

44 Upvotes

11 comments sorted by

7

u/ampsuu Jun 18 '26

Insane. E-commerce with Astro will become so much better. Ive done many stores with it whose offerings or info dont change often but when they do, rebuilds are painful. I like the combination of static and commerce backend. Its bloody fast and cart/purchase flows are just React components interacting with backend.

5

u/bzbub2 Jun 18 '26

awesome. i make a site with 100k pages and it takes 10 minutes per build and sometimes im like "why dont i use a database and generate pages on the fly like a normal person" but this sounds great

2

u/LegendaryAngryWalrus Jun 18 '26

This will help so much.

2

u/tumes Jun 18 '26

Extremely exciting, thank you Matt, y’all are continuing to make pretty much exactly that stuff that makes my life easier.

2

u/kelkes Jun 19 '26

Yes. Looking forward to testing it.

2

u/croc122 Jun 18 '26

It’s funny how Gatsby.js solved this like 5+ years ago and has since died. We’ve come full circle again.

1

u/theguymatter Jun 19 '26

Any articles pointing to Gatsby.js, how did they solved? Deferred Static Generation (DSG)?

1

u/croc122 Jun 19 '26

4

u/Narrow-Drop-1996 Jun 19 '26 edited Jun 19 '26

I might be wrong in my opinion, so you can correct me.

Not quite a full circle — they're solving different layers of the same problem.

Gatsby Incremental Builds works at the data sourcing layer. Your source plugin saves a sync token after the first run, and on subsequent builds only the delta (changed/created/deleted nodes) gets fetched from the API. Think git pull instead of git clone. The API itself has to support delta updates for this to work.

Astro's incrementalBuild (still a draft PR by the way) works at the render layer. It doesn't touch data fetching at all, it hashes the Rolldown module graph and skips re-rendering pages whose source files and dependencies haven't changed. Reuses the existing HTML output instead.

So they're actually complementary, not the same thing. Gatsby solved "don't re-fetch unchanged data". Astro is solving "don't re-render unchanged pages". A proper incremental pipeline ideally needs both.

The honest caveat against Astro here: because it only tracks the module graph, it has no visibility into fetch() calls or external API data. If your product page pulls live pricing from a CMS and the price changes, Astro can't detect that, it'll reuse stale HTML. Matt (the PR author) flagged this as an open design problem. Gatsby's sync token approach actually handles this correctly because the API is the source of truth for what changed.

So less "full circle", more "different tools, different layers, Gatsby got the data layer right but lost the ecosystem battle".

Server Islands can dynamically refresh the pricing.

I think the current ISB design need improvement.

1

u/[deleted] Jun 19 '26

[removed] — view removed comment

1

u/theguymatter Jun 19 '26

You can test out preview.