(build-initial-state state-tree root-class)
This function normalizes the given state-tree using the root-component's query into standard client db format, it then walks the query and adds any missing data from union branches that are not the 'default' branch on the union itself. E.g. A union with initial state can only point to one thing, but you need the other branches in the normalized application database. Assumes all components (except possibly root-class) that need initial state use InitialAppState.
Useful for building a pre-populated db for server-side rendering.
Returns a normalized client db with all union alternates initialized to their InitialAppState.
This function normalizes the given state-tree using the root-component's query into standard client db format, it then walks the query and adds any missing data from union branches that are not the 'default' branch on the union itself. E.g. A union with initial state can only point to one thing, but you need the other branches in the normalized application database. Assumes all components (except possibly root-class) that need initial state use InitialAppState. Useful for building a pre-populated db for server-side rendering. Returns a normalized client db with all union alternates initialized to their InitialAppState.
(get-SSR-initial-state)
Obtain the value of the INITIAL_APP_STATE set from server-side rendering. Use initial-state->script-tag on the server to embed the state.
Obtain the value of the INITIAL_APP_STATE set from server-side rendering. Use initial-state->script-tag on the server to embed the state.
(initial-state->script-tag initial-state)
Returns a string containing an HTML script tag that that sets js/window.INITIAL_APP_STATE to a transit-encoded string version of initial-state.
Returns a string containing an HTML script tag that that sets js/window.INITIAL_APP_STATE to a transit-encoded string version of initial-state.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close