Merge pull request #1252 from Demonthos/non-generic-link

Remove autogenerated functions/components from the routable macro
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2023-07-26 18:11:32 -07:00
commit 418c03e2cd
47 files changed
+569 -284

No files matched your search

+5 -9
View File
@@ -16,7 +16,7 @@ where
let cfg = *cx.props;
render! {
dioxus_router::prelude::GenericRouter::<R> {
dioxus_router::prelude::Router::<R> {
config: move || {
RouterConfig::default()
.failure_external_navigation(cfg.failure_external_navigation)
@@ -49,12 +49,8 @@ where
}
}
fn default_external_navigation_handler<R>() -> fn(Scope) -> Element
where
R: dioxus_router::prelude::Routable,
<R as std::str::FromStr>::Err: std::fmt::Display,
{
dioxus_router::prelude::FailureExternalNavigation::<R>
fn default_external_navigation_handler() -> fn(Scope) -> Element {
dioxus_router::prelude::FailureExternalNavigation
}
/// The configeration for the router
@@ -65,7 +61,7 @@ where
<R as std::str::FromStr>::Err: std::fmt::Display,
{
#[serde(skip)]
#[serde(default = "default_external_navigation_handler::<R>")]
#[serde(default = "default_external_navigation_handler")]
failure_external_navigation: fn(Scope) -> Element,
scroll_restoration: bool,
#[serde(skip)]
@@ -96,7 +92,7 @@ where
{
fn default() -> Self {
Self {
failure_external_navigation: dioxus_router::prelude::FailureExternalNavigation::<R>,
failure_external_navigation: dioxus_router::prelude::FailureExternalNavigation,
scroll_restoration: true,
phantom: std::marker::PhantomData,
}