Function leptos_dom::ssr::render_to_stream_with_prefix_undisposed_with_context_and_block_replacement
source · pub fn render_to_stream_with_prefix_undisposed_with_context_and_block_replacement(
view: impl FnOnce() -> View + 'static,
prefix: impl FnOnce() -> Oco<'static, str> + 'static,
additional_context: impl FnOnce() + 'static,
replace_blocks: bool
) -> (impl Stream<Item = String>, RuntimeId)
Expand description
Renders a function to a stream of HTML strings and returns the RuntimeId that was created, so
they can be disposed when appropriate. After the view
runs, the prefix
will run with
the same scope. This can be used to generate additional HTML that has access to the same reactive graph.
If replace_blocks
is true, this will wait for any fragments with blocking resources and
actually replace them in the initial HTML. This is slower to render (as it requires walking
back over the HTML for string replacement) but has the advantage of never including those fallbacks
in the HTML.
This renders:
- the prefix
- the application shell
a) HTML for everything that is not under a
<Suspense/>
, b) thefallback
for any<Suspense/>
component that is not already resolved, and c) JavaScript necessary to receive streaming Resource data. - streaming Resource data. Resources begin loading on the server and are sent down to the browser to resolve. On the browser, if the app sees that it is waiting for a resource to resolve from the server, it doesn’t run it initially.
- HTML fragments to replace each
<Suspense/>
fallback with its actual data as the resources read under that<Suspense/>
resolve.