stereobooster / react-snap

👻 Zero-configuration framework-agnostic static prerendering for SPAs
MIT License
5.06k stars 394 forks source link

snapSaveState for separate pages? #302

Closed NickyTesla closed 5 years ago

NickyTesla commented 5 years ago

I was wondering when snapSaveState executes? Does it execute for each page?

I'm building a site that's essentially a blog with lots of text content, and it might get pretty big. I'm realizing it will be terribly inefficient to send down the preloaded data (basically all the site data) with every initial page request. It would be nice if it executed on a per page basis and I could just save page specific states to be sent in that page's HTML-- that way I could have the appropriate state for rehydration and avoid the "flash" but avoid sending an ever growing JSON obj down in the initial request...

Is this possible? Or are there other recommended solutions to the problem of the 'large static site'.

Also is there a page limit?

stereobooster commented 5 years ago

I was wondering when snapSaveState executes? Does it execute for each page?

Yes. It is executed for each page and data saved in html of each page.

Also is there a page limit?

No formal limit, the limit is only how much time you want to wait.

NickyTesla commented 5 years ago

Yep just ran a test and saw that. Thank you!