From cf7deaaea386d4c90239612ef8655c41b0e7fef4 Mon Sep 17 00:00:00 2001 From: Greg Johnston Date: Sat, 11 Feb 2023 14:12:59 -0500 Subject: [PATCH] fix: proper disposal of nested route scopes (#499) --- examples/router/src/lib.rs | 39 ++++++++++++++- leptos_reactive/src/scope.rs | 1 - router/src/components/outlet.rs | 8 +-- router/src/components/routes.rs | 88 +++++++++++++-------------------- 4 files changed, 77 insertions(+), 59 deletions(-) diff --git a/examples/router/src/lib.rs b/examples/router/src/lib.rs index 48bc101..54b73ca 100644 --- a/examples/router/src/lib.rs +++ b/examples/router/src/lib.rs @@ -1,14 +1,18 @@ mod api; - +use crate::api::*; use leptos::*; use leptos_router::*; -use crate::api::{get_contact, get_contacts}; +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +struct ExampleContext(i32); #[component] pub fn RouterExample(cx: Scope) -> impl IntoView { log::debug!("rendering "); + // contexts are passed down through the route tree + provide_context(cx, ExampleContext(0)); + view! { cx,