Liking cljdoc? Tell your friends :D

fulcro.server-render


build-initial-stateclj/s

(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.
sourceraw docstring

defer-until-network-idlecljs

(defer-until-network-idle reconciler callback)
(defer-until-network-idle reconciler callback remote)

Schedule a function to run when all remotes (or the specified one) have become idle. The function will not be called on transition edges (idle but outstanding queued items). This function is meant for scheduling server-side rendering in node.js when you're running a real client against loopback remotes in order to get pre-rendered html. Of course, it can only detect network activity on remotes the reconciler controls. Side-band networking through external APIs is not detected.

This function is not meant for general-purpose use in a client and is not supported for anything but SSR in node. Using it in other contexts should work, but are discouraged as a poor pattern for Fulcro.

Schedule a function to run when all remotes (or the specified one) have become idle.  The function will not
be called on transition edges (idle but outstanding queued items).  This function is meant for scheduling
server-side rendering in `node.js` when you're running a real client against loopback remotes in order to
get pre-rendered html.  Of course, it can only detect network activity on remotes the reconciler controls.
Side-band networking through external APIs is not detected.

This function is not meant for general-purpose use in a client and is not supported for anything but SSR
in node.  Using it in other contexts should work, but are discouraged as a poor pattern for Fulcro.
sourceraw docstring

get-SSR-initial-statecljs

(get-SSR-initial-state)
(get-SSR-initial-state opts)

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.
sourceraw docstring

initial-state->script-tagclj

(initial-state->script-tag initial-state)
(initial-state->script-tag initial-state opts)
(initial-state->script-tag initial-state opts string-transform)

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.

opts is a map to be passed to the transit writer. string-transform should be a function with 1 argument. The stringified app-state is passed to it. This is the place to perform additional string replacement operations to escape special characters, as in the case of encoded polylines.

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.

`opts` is a map to be passed to the transit writer.
`string-transform` should be a function with 1 argument. The stringified app-state is passed to it.
This is the place to perform additional string replacement operations to escape special characters,
as in the case of encoded polylines.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close