Is it possible to add `initialState` after invoking enhance-ssr?
tbeseda opened this issue · 1 comments
Let's say I have a function that returns some HTML rendered by Enhance SSR
function (req) {
const html = enhance({
/* ... a lot of config for
elements,
transforms,
and state. */
})
// a bunch of logic based on req
return html`<my-page></my-page>`
}
Can I change initialState
on my html
method before returning a result?
I could just create the html
method later in my function when the initialState is settled, but I may want to actually return early to avoid extra computation and branching logic.
Basically, everything is the same for each invocation of my function, except the state I want to pass to Enhance.
This could also be nice if I want to create html
outside of the main function and potentially reuse it in subsequent requests to that function -- thinking about a "warm" Lambda.
No this is just for initial render.
In the client you will be able to subscribe to a store and re-render to updates.