From 7c5b7fcbb109d7781c100a87b30e5cdf77c32426 Mon Sep 17 00:00:00 2001 From: Greg Johnston Date: Sat, 22 Jun 2024 10:13:52 -0400 Subject: [PATCH] update islands example --- examples/islands/src/app.rs | 19 +++++++++++++++++++ examples/islands/src/fallback.rs | 8 +++----- examples/islands/src/main.rs | 22 ++-------------------- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/examples/islands/src/app.rs b/examples/islands/src/app.rs index 2bb78565e..e6a968d35 100644 --- a/examples/islands/src/app.rs +++ b/examples/islands/src/app.rs @@ -1,5 +1,24 @@ use leptos::prelude::*; +pub fn shell(options: &LeptosOptions) -> impl IntoView { + view! { + + + + + + + + + + + + + + + } +} + #[component] pub fn App() -> impl IntoView { view! { diff --git a/examples/islands/src/fallback.rs b/examples/islands/src/fallback.rs index c7238f1ca..f074b524d 100644 --- a/examples/islands/src/fallback.rs +++ b/examples/islands/src/fallback.rs @@ -1,4 +1,4 @@ -use crate::{error_template::ErrorTemplate, errors::TodoAppError}; +use crate::{app::shell, error_template::ErrorTemplate, errors::TodoAppError}; use axum::{ body::Body, extract::State, @@ -22,10 +22,8 @@ pub async fn file_and_error_handler( } else { let mut errors = Errors::default(); errors.insert_with_default_key(TodoAppError::NotFound); - let handler = leptos_axum::render_app_to_stream( - options.to_owned(), - move || view! { }, - ); + let handler = + leptos_axum::render_app_to_stream(move || shell(&options)); handler(req).await.into_response() } } diff --git a/examples/islands/src/main.rs b/examples/islands/src/main.rs index 7dee03cc5..2ff70f2eb 100644 --- a/examples/islands/src/main.rs +++ b/examples/islands/src/main.rs @@ -26,26 +26,8 @@ async fn main() { let app = Router::new() .leptos_routes(&leptos_options, routes, { let leptos_options = leptos_options.clone(); - move || { - use leptos::prelude::*; - - view! { - - - - - - - - - - - - - - - } - }}) + move || shell(&leptos_options) + }) .fallback(file_and_error_handler) .with_state(leptos_options);