/// Interpolates page data into the shell.
Interpolates page data into the shell.
Interpolates page data into the shell .
pub fn page_data(mut self, page_data: &'a PageData) -> Self {
        // Interpolate a global variable of the state so the app shell doesn't have to make any more trips
        // The app shell will unset this after usage so it doesn't contaminate later non-initial loads
        // Error pages (above) will set this to `error`
        let initial_state = if let Some(state) = &page_data.state {
            escape_page_data(state)
        } else {
            "None".to_string()
        };
        // We put this at the very end of the head (after the delimiter comment) because it doesn't matter if it's expunged on subsequent loads
        let initial_state = format!("window.__PERSEUS_INITIAL_STATE = `{}`", initial_state);
        self.scripts_after_boundary.push(initial_state.into());
        // Interpolate the document `<head>` (this should of course be removed between page loads)
        self.head_after_boundary.push((&page_data.head).into());
        // And set the content
        self.content = (&page_data.content).into();
        self
    }
pub fn page_data ( mut self , page_data : & ' a PageData ) -> Self { // Interpolate a global variable of the state so the app shell doesn't have to make any more trips // The app shell will unset this after usage so it doesn't contaminate later non-initial loads // Error pages (above) will set this to `error` let initial_state = if let Some ( state ) = & page_data . state { escape_page_data ( state ) } else { " " . to_string ( ) } ; // We put this at the very end of the head (after the delimiter comment) because it doesn't matter if it's expunged on subsequent loads let initial_state = format ! ( " " initial_state ) ; self . scripts_after_boundary . push ( initial_state . into ( ) ) ; // Interpolate the document `<head>` (this should of course be removed between page loads) self . head_after_boundary . push ( ( & page_data . head ) . into ( ) ) ; // And set the content self . content = ( & page_data . content ) . into ( ) ; self }
Interpolates page data into the shell.
Interpolates page data into the shell .
mut self
page_data
&'a PageData