solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

Feature Request - Incremental Static Regeneration (ISR)

Open jdgamble555 opened this issue 2 years ago • 4 comments

There doesn't seem to be an official feature request for this, and the talk is short on discord. I also believe there is confusion on what this is.

There needs to be a way to automatically handle the cache-control header in routes so that refreshing at different intervals, or caching an entire route is possible until some sort of invalidation.

https://nextjs.org/docs/basic-features/data-fetching/incremental-static-regeneration https://www.vuemastery.com/blog/new-nuxt-3-feature-incremental-static-generation/

  • Rich Harris has said this will be released in SvelteKit first thing after V1.

It may would need to be handled inside solid-start, then have the adapters handle the specific serverless environments. This is huge for many potential adopters, as having an easy way to cache their api endpoints is crucial for saving money on database reads, and faster page loads. Having the ability to call a trigger to revalidate a route would really help, for example when the database gets updated. A new deployment would regenerate all routes.

Cache-control

  • https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
  • https://vercel.com/docs/concepts/edge-network/caching
  • https://docs.netlify.com/routing/headers/
  • https://firebase.google.com/docs/hosting/manage-cache

Remix does not have ISR, and claims that it is vendor-lock-in for Next and Vercel, which is simply not true. All hosting providers for NextJS offer the framework way of doing this. This is also true for NuxtJS, and will soon be true with the adapters for SvelteKit.

Please add this feature, as I believe it will be the reason a lot of people switch from Next to Solid Start.

J

jdgamble555 avatar Nov 15 '22 13:11 jdgamble555

Hello, I got a version of this working today. Over the course of the week I plan to make a pull request to the vercel adapter. Just need to test it a bit more, and play with which settings are needed, like the bypassValue, expiration, etc...

jpmaga avatar Nov 21 '22 13:11 jpmaga

Turns out I had bit more time today than expected. https://github.com/solidjs/solid-start/pull/466

jpmaga avatar Nov 21 '22 15:11 jpmaga

Oh nice! Is this all routes, or does it let you customize the cache based on the router?

Also, it seems for this moment in time, Vercel is the only serverless platform that has on-demand revalidation, but we hope that changes soon.

Thanks,

J

jdgamble555 avatar Nov 21 '22 15:11 jdgamble555

Oh nice! Is this all routes, or does it let you customize the cache based on the router?

Also, it seems for this moment in time, Vercel is the only serverless platform that has on-demand revalidation, but we hope that changes soon.

Thanks,

J

I am not sure. I think the prerender functions take precedence over http headers. If that is the case, then it won't be possible to fine tune the routes without some considerable code changes on the adapter.

Yeah, on-demand revalidation is the killer deal here, at least for me and my company.

jpmaga avatar Nov 21 '22 16:11 jpmaga

Yes need this feature badly. Next js already has this feature. Need it in solid start as well.

subhasishdas159 avatar Mar 19 '23 13:03 subhasishdas159

In setting up for SolidStarts next Beta Phase built on Nitro and Vinxi we are closing all PRs/Issues that will not be merged due to the system changing. If you feel your issue was closed in mistake. Feel free to re-open it after updating/testing against 0.4.x release. Thank you for your patience.

See https://github.com/solidjs/solid-start/pull/1139 for more details.

ryansolid avatar Dec 18 '23 23:12 ryansolid