Compare commits

...

2 Commits

Author SHA1 Message Date
Greg Johnston
2c61613b9e fix release mode 2023-04-04 19:51:58 -04:00
Greg Johnston
5caa457a22 fix: prevent router panic on root-level <Redirect/> during route list generation 2023-04-04 17:40:31 -04:00

View File

@@ -37,11 +37,21 @@ where
// redirect on the client
else {
let navigate = use_navigate(cx);
#[cfg(any(feature = "csr", feature = "hydrate"))]
leptos::request_animation_frame(move || {
if let Err(e) = navigate(&path, options.unwrap_or_default()) {
leptos::error!("<Redirect/> error: {e:?}");
}
});
#[cfg(not(any(feature = "csr", feature = "hydrate")))]
{
leptos::debug_warn!(
"<Redirect/> is trying to redirect without \
`ServerRedirectFunction` being provided. (If youre getting \
this on initial server start-up, its okay to ignore. It \
just means that your root route is a redirect.)"
);
}
}
}