Skip to content

Commit

Permalink
fix: fixed router
Browse files Browse the repository at this point in the history
Needed another `create_effect` or routing is fundamentally broken.
  • Loading branch information
arctic-hen7 committed Jan 28, 2022
1 parent 27880a5 commit 2260885
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/perseus/src/router/router_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,11 @@ pub fn perseus_router<AppRoute: PerseusRoute<TemplateNodeType> + 'static>(
Router(RouterProps::new(HistoryIntegration::new(), cloned!(on_route_change_props => move |route: ReadSignal<AppRoute>| {
// Sycamore's reactivity is broken by a future, so we need to explicitly add the route to the reactive dependencies here
// We do need the future though (otherwise `container_rx` doesn't link to anything until it's too late)
let verdict = route.get().get_verdict().clone();
on_route_change(verdict, on_route_change_props);
create_effect(cloned!(route, on_route_change_props => move || {
let verdict = route.get().get_verdict().clone();
crate::web_log!("test");
on_route_change(verdict, on_route_change_props.clone());
}));

// This template is reactive, and will be updated as necessary
// However, the server has already rendered initial load content elsewhere, so we move that into here as well in the app shell
Expand Down

0 comments on commit 2260885

Please sign in to comment.