composition-api icon indicating copy to clipboard operation
composition-api copied to clipboard

feat: Write JSON files on SSR with useStatic

Open Rigo-m opened this issue 4 years ago • 0 comments

🆒 Your use case What if I have a huge website with expensive calls and I can't generate each page (let's say some pages are pre-generated and some are not). I'd like to be able to leverage useStatic functionality because it can be used both on generated routes and on SSR routes and it all works correctly.

But what if I want to create some sort of ISR leveraging useStatic? I can set a regeneration strategy (time-based or commit-based or whatever) and write the JSON payload of the factory function whenever the cache has been voided or the JSON file isn't there, instead of just running the factory function in the client.

🆕 The solution you'd like I'd like to have a way to call the factory function in the server from the client so that the JSON gets generated and is available on the next hit to the same page

Rigo-m avatar Aug 17 '21 09:08 Rigo-m