Is there a way to cache HTML eternally (until next rebuild)?
Unanswered
Satin posted this in #help-forum
SatinOP
I have an SSR'ed website that has a single part of it that's dynamic: whether it says "Dashboard ->" or "Login ->" on the top right of the website.
It feels kind of wasteful to have the website regenerate on every single user request. Is there a way to SSG both copies of the site (one with "Dashboard ->" and one with "Login ->") and serve either the former or the latter based on whether the user has a valid JWT in their cookies or not? I feel like that would improve page load speed.
It feels kind of wasteful to have the website regenerate on every single user request. Is there a way to SSG both copies of the site (one with "Dashboard ->" and one with "Login ->") and serve either the former or the latter based on whether the user has a valid JWT in their cookies or not? I feel like that would improve page load speed.
6 Replies
This is the premise of PPR (partial pre rendering) that you can opt into:)
Like certain parts static and others still dynamic
@Satin I have an SSR'ed website that has a single part of it that's dynamic: whether it says "Dashboard ->" or "Login ->" on the top right of the website.
It feels kind of wasteful to have the website regenerate on *every* single user request. Is there a way to SSG both copies of the site (one with "Dashboard ->" and one with "Login ->") and serve either the former or the latter based on whether the user has a valid JWT in their cookies or not? I feel like that would improve page load speed.
the expensive part is the check JWT part. generating the html takes like what? 2 ms? it's extremely fast.
so doing that will save you nothing.
so doing that will save you nothing.
@joulev the expensive part is the check JWT part. generating the html takes like what? 2 ms? it's extremely fast.
so doing that will save you nothing.
SatinOP
I haven’t benchmarked it and I’ll take your word for it; I moved from SSG -> SSR recently and was disappointed to see a significant increase in TTFB. Perhaps it’s unavoidable if I want to check JWT first tho
@riský This is the premise of PPR (partial pre rendering) that you can opt into:)
SatinOP
Ooo let me look into it! Seems interesting!
SatinOP
hm it says experimental.. not sure if this is safe for production..?