mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 14:54:16 +00:00
Remove extra
This commit is contained in:
parent
2d88524354
commit
3e04318082
3 changed files with 11 additions and 19 deletions
|
@ -33,7 +33,6 @@ sqlx = { version = "0.6.2", features = [
|
||||||
"runtime-tokio-rustls",
|
"runtime-tokio-rustls",
|
||||||
"sqlite",
|
"sqlite",
|
||||||
], optional = true }
|
], optional = true }
|
||||||
thiserror = "1.0.38"
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["csr"]
|
default = ["csr"]
|
||||||
|
|
|
@ -3,8 +3,6 @@ use leptos::*;
|
||||||
use leptos_meta::*;
|
use leptos_meta::*;
|
||||||
use leptos_router::*;
|
use leptos_router::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use crate:: error_template::error_template;
|
|
||||||
use crate::error::TodoAppError;
|
|
||||||
|
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(feature = "ssr")] {
|
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()))
|
.map_err(|e| ServerFnError::ServerError(e.to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
|
||||||
pub fn Error(cx: Scope) -> impl IntoView{
|
|
||||||
Err::<String, TodoAppError>(TodoAppError::AnError)
|
|
||||||
}
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn TodoApp(cx: Scope) -> impl IntoView {
|
pub fn TodoApp(cx: Scope) -> impl IntoView {
|
||||||
provide_meta_context(cx);
|
provide_meta_context(cx);
|
||||||
|
@ -126,10 +120,9 @@ pub fn TodoApp(cx: Scope) -> impl IntoView {
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="" view=|cx| view! {
|
<Route path="" view=|cx| view! {
|
||||||
cx,
|
cx,
|
||||||
<ErrorBoundary fallback=error_template>
|
|
||||||
<Todos/>
|
<Todos/>
|
||||||
</ErrorBoundary>
|
|
||||||
}/>
|
}/>
|
||||||
|
|
||||||
</Routes>
|
</Routes>
|
||||||
</main>
|
</main>
|
||||||
</Router>
|
</Router>
|
||||||
|
@ -159,7 +152,6 @@ pub fn Todos(cx: Scope) -> impl IntoView {
|
||||||
</label>
|
</label>
|
||||||
<input type="submit" value="Add"/>
|
<input type="submit" value="Add"/>
|
||||||
</MultiActionForm>
|
</MultiActionForm>
|
||||||
<Error/>
|
|
||||||
<Transition fallback=move || view! {cx, <p>"Loading..."</p> }>
|
<Transition fallback=move || view! {cx, <p>"Loading..."</p> }>
|
||||||
{move || {
|
{move || {
|
||||||
let existing_todos = {
|
let existing_todos = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{HydrationCtx, HydrationKey, IntoView};
|
use crate::{HydrationCtx, HydrationKey, IntoView};
|
||||||
use cfg_if::cfg_if;
|
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};
|
use std::{collections::HashMap, error::Error, rc::Rc};
|
||||||
|
|
||||||
/// A struct to hold all the possible errors that could be provided by child Views
|
/// 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
|
// 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
|
// Only can run on the client, will panic on the server
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(feature = "hydrate")] {
|
if #[cfg(any(feature = "hydrate", feature="csr"))] {
|
||||||
on_cleanup(cx, move || {
|
use leptos_reactive::{on_cleanup, queue_microtask};
|
||||||
queue_microtask(move || {
|
on_cleanup(cx, move || {
|
||||||
errors.update(|errors: &mut Errors| {
|
queue_microtask(move || {
|
||||||
errors.remove::<E>(&id);
|
errors.update(|errors: &mut Errors| {
|
||||||
});
|
errors.remove::<E>(&id);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
|
|
Loading…
Reference in a new issue