mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 23:04:24 +00:00
Merge pull request #239 from gbj/router-off-by-one
Fixes off-by-one error in the router that was causing inappropriate scope disposal
This commit is contained in:
commit
ed023c8970
2 changed files with 2 additions and 2 deletions
|
@ -20,7 +20,6 @@ pub fn Outlet(cx: Scope) -> impl IntoView {
|
|||
}
|
||||
(Some(child), prev) => {
|
||||
if let Some(prev_scope) = prev.map(|(_, scope)| scope) {
|
||||
leptos::log!("disposing previous scope");
|
||||
prev_scope.dispose();
|
||||
}
|
||||
is_showing.set(Some((child.id(), child.cx())));
|
||||
|
|
|
@ -140,7 +140,8 @@ pub fn Routes(
|
|||
|
||||
if disposers.borrow().len() > i + 1 {
|
||||
let mut disposers = disposers.borrow_mut();
|
||||
let old_route_disposer = std::mem::replace(&mut disposers[i], disposer);
|
||||
let old_route_disposer =
|
||||
std::mem::replace(&mut disposers[i + 1], disposer);
|
||||
old_route_disposer.dispose();
|
||||
} else {
|
||||
disposers.borrow_mut().push(disposer);
|
||||
|
|
Loading…
Reference in a new issue