Remove extra

This commit is contained in:
benwis 2023-01-21 10:58:47 -08:00
parent 2d88524354
commit 3e04318082
3 changed files with 11 additions and 19 deletions

View file

@ -33,7 +33,6 @@ sqlx = { version = "0.6.2", features = [
"runtime-tokio-rustls",
"sqlite",
], optional = true }
thiserror = "1.0.38"
[features]
default = ["csr"]

View file

@ -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::<String, TodoAppError>(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 {
<Routes>
<Route path="" view=|cx| view! {
cx,
<ErrorBoundary fallback=error_template>
<Todos/>
</ErrorBoundary>
}/>
</Routes>
</main>
</Router>
@ -159,7 +152,6 @@ pub fn Todos(cx: Scope) -> impl IntoView {
</label>
<input type="submit" value="Add"/>
</MultiActionForm>
<Error/>
<Transition fallback=move || view! {cx, <p>"Loading..."</p> }>
{move || {
let existing_todos = {

View file

@ -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::<E>(&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::<E>(&id);
});
});
});
}
}
}
}
None => {
#[cfg(debug_assertions)]