async fn render_request_state(
    template: &Template<SsrNode>,
    translator: &Translator,
    path: &str,
    req: Request,
) -> Result<(String, String, Option<String>), ServerError> {
    // Generate the initial state (this may generate an error, but there's no file that can't exist)
    let state = Some(
        template
            .get_request_state(path.to_string(), translator.get_locale(), req)
            .await?,
    );
    // Use that to render the static HTML
    let html = sycamore::render_to_string(|| {
        template.render_for_template(
            state.clone(),
            translator,
            true,
            RouterState::default(),
            GlobalState::default(),
        )
    });
    let head = template.render_head_str(state.clone(), translator);

    Ok((html, head, state))
}
/// Renders a template that generated its state at request-time. Note that revalidation and incremental generation have no impact on
/// SSR-rendered pages. This does everything at request-time, and so doesn't need a mutable or immutable store.
Renders a template that generated its state at request-time. Note that revalidation and incremental generation have no impact on
SSR-rendered pages. This does everything at request-time, and so doesn't need a mutable or immutable store.
Renders a template that generated its state at request - time . Note that revalidation and incremental generation have no impact on SSR - rendered pages . This does everything at request - time and so doesn ' t need a mutable or immutable store .
async fn render_request_state(
    template: &Template<SsrNode>,
    translator: &Translator,
    path: &str,
    req: Request,
) -> Result<(String, String, Option<String>), ServerError> {
    // Generate the initial state (this may generate an error, but there's no file that can't exist)
    let state = Some(
        template
            .get_request_state(path.to_string(), translator.get_locale(), req)
            .await?,
    );
    // Use that to render the static HTML
    let html = sycamore::render_to_string(|| {
        template.render_for_template(
            state.clone(),
            translator,
            true,
            RouterState::default(),
            GlobalState::default(),
        )
    });
    let head = template.render_head_str(state.clone(), translator);
    Ok((html, head, state))
}
async fn render_request_state ( template : & Template < SsrNode > , translator : & Translator , path : & str , req : Request , ) -> Result < ( String , String , Option < String > ) , ServerError > { // Generate the initial state (this may generate an error, but there's no file that can't exist) let state = Some ( template . get_request_state ( path . to_string ( ) , translator . get_locale ( ) , req ) . await ? , ) ; // Use that to render the static HTML let html = sycamore :: render_to_string ( | | { template . render_for_template ( state . clone ( ) , translator , true , RouterState :: default ( ) , GlobalState :: default ( ) , ) } ) ; let head = template . render_head_str ( state . clone ( ) , translator ) ; Ok ( ( html , head , state ) ) }
Renders a template that generated its state at request-time.
Renders a template that generated its state at request - time .
template
&Template<SsrNode>
translator
&Translator
path
&str
req
Request
template
&Template<SsrNode>
translator
&Translator
path
&str
req
Request