diff --git a/examples/todo_app_sqlite_axum/Cargo.toml b/examples/todo_app_sqlite_axum/Cargo.toml index c0d5dde68..01e633646 100644 --- a/examples/todo_app_sqlite_axum/Cargo.toml +++ b/examples/todo_app_sqlite_axum/Cargo.toml @@ -33,7 +33,6 @@ sqlx = { version = "0.6.2", features = [ "runtime-tokio-rustls", "sqlite", ], optional = true } -thiserror = "1.0.38" [features] default = ["csr"] diff --git a/examples/todo_app_sqlite_axum/src/todo.rs b/examples/todo_app_sqlite_axum/src/todo.rs index 2f0ea1ab5..72c42d919 100644 --- a/examples/todo_app_sqlite_axum/src/todo.rs +++ b/examples/todo_app_sqlite_axum/src/todo.rs @@ -3,8 +3,6 @@ use leptos::*; use leptos_meta::*; use leptos_router::*; use serde::{Deserialize, Serialize}; -use crate:: error_template::error_template; -use crate::error::TodoAppError; cfg_if! { if #[cfg(feature = "ssr")] { @@ -107,10 +105,6 @@ pub async fn delete_todo(id: u16) -> Result<(), ServerFnError> { .map_err(|e| ServerFnError::ServerError(e.to_string())) } -#[component] -pub fn Error(cx: Scope) -> impl IntoView{ - Err::(TodoAppError::AnError) -} #[component] pub fn TodoApp(cx: Scope) -> impl IntoView { provide_meta_context(cx); @@ -126,10 +120,9 @@ pub fn TodoApp(cx: Scope) -> impl IntoView { - }/> + @@ -159,7 +152,6 @@ pub fn Todos(cx: Scope) -> impl IntoView { - "Loading..."

}> {move || { let existing_todos = { diff --git a/leptos_dom/src/components/errors.rs b/leptos_dom/src/components/errors.rs index cf1996b61..95a191ed3 100644 --- a/leptos_dom/src/components/errors.rs +++ b/leptos_dom/src/components/errors.rs @@ -1,6 +1,6 @@ use crate::{HydrationCtx, HydrationKey, IntoView}; use cfg_if::cfg_if; -use leptos_reactive::{on_cleanup, queue_microtask, use_context, RwSignal}; +use leptos_reactive::{use_context, RwSignal}; use std::{collections::HashMap, error::Error, rc::Rc}; /// A struct to hold all the possible errors that could be provided by child Views @@ -28,16 +28,17 @@ where // i.e., if it's in a DynChild that switches from Err to Ok // Only can run on the client, will panic on the server cfg_if! { - if #[cfg(feature = "hydrate")] { - on_cleanup(cx, move || { - queue_microtask(move || { - errors.update(|errors: &mut Errors| { - errors.remove::(&id); - }); - }); + if #[cfg(any(feature = "hydrate", feature="csr"))] { + use leptos_reactive::{on_cleanup, queue_microtask}; + on_cleanup(cx, move || { + queue_microtask(move || { + errors.update(|errors: &mut Errors| { + errors.remove::(&id); }); + }); + }); + } } - } } None => { #[cfg(debug_assertions)]