SSG isn't truly static
It seems like I have wrong presumption about what SSG meant.
I want some routes on my site to be static - i.e. at build time it should do some async server stuff (like reading data from DB, read some files from file system, etc. ) --> Then populate the data into the markup, and return the page static.
But that doesn't seem to work. One demonstration is: I have a route called
My expectation is that: This random number is generated ONCE during build time, and then all clients, regardless of page refresh or what not, will always see this same number.
After building, if I directly access the '
I want some routes on my site to be static - i.e. at build time it should do some async server stuff (like reading data from DB, read some files from file system, etc. ) --> Then populate the data into the markup, and return the page static.
But that doesn't seem to work. One demonstration is: I have a route called
random that generates a random number --> I configured server: { prerender: {routes: ['/random'] }}} (route code below)My expectation is that: This random number is generated ONCE during build time, and then all clients, regardless of page refresh or what not, will always see this same number.
After building, if I directly access the '
/random' URL that is fine - page refresh won't change the number. However, if I visit the another page first, and then visit the /random page via my navbar (which I uses presume is where the Client-side router kicks in), the page is still dynamic -> It still tries to make HTTP requests to my server functions, and returns a different number each time