reorganize Outlet export
This commit is contained in:
parent
b5551863fe
commit
fbc6be922d
|
@ -3,10 +3,10 @@ use crate::api::*;
|
|||
use leptos::either::Either;
|
||||
use leptos::prelude::*;
|
||||
use leptos_router::{
|
||||
components::{ParentRoute, Redirect, Route, Router, Routes, A},
|
||||
components::{Outlet, ParentRoute, Redirect, Route, Router, Routes, A},
|
||||
hooks::{use_navigate, use_params, use_query_map},
|
||||
params::Params,
|
||||
MatchNestedRoutes, Outlet, ParamSegment, StaticSegment,
|
||||
MatchNestedRoutes, ParamSegment, StaticSegment,
|
||||
};
|
||||
use tracing::info;
|
||||
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
pub use super::link::*;
|
||||
#[cfg(feature = "ssr")]
|
||||
use crate::location::RequestUrl;
|
||||
pub use crate::nested_router::Outlet;
|
||||
use crate::{
|
||||
flat_router::FlatRoutesView,
|
||||
hooks::use_navigate,
|
||||
location::{
|
||||
BrowserUrl, Location, LocationChange, LocationProvider, State, Url,
|
||||
},
|
||||
navigate::NavigateOptions,
|
||||
nested_router::NestedRoutesView,
|
||||
resolve_path::resolve_path,
|
||||
ChooseView, FlatRoutesView, MatchNestedRoutes, NestedRoute,
|
||||
NestedRoutesView, Routes, SsrMode,
|
||||
ChooseView, MatchNestedRoutes, NestedRoute, Routes, SsrMode,
|
||||
};
|
||||
use leptos::prelude::*;
|
||||
use reactive_graph::{
|
||||
|
@ -344,6 +346,14 @@ where
|
|||
}
|
||||
// redirect on the client
|
||||
else {
|
||||
if cfg!(feature = "ssr") {
|
||||
#[cfg(feature = "tracing")]
|
||||
tracing::warn!(
|
||||
"Calling <Redirect/> without a ServerRedirectFunction \
|
||||
provided, in SSR mode."
|
||||
);
|
||||
return;
|
||||
}
|
||||
let navigate = use_navigate();
|
||||
navigate(&path, options.unwrap_or_default());
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@ use crate::{
|
|||
components::RouterContext,
|
||||
location::{Location, Url},
|
||||
navigate::NavigateOptions,
|
||||
nested_router::RouteContext,
|
||||
params::{Params, ParamsError, ParamsMap},
|
||||
RouteContext,
|
||||
};
|
||||
use reactive_graph::{
|
||||
computed::{ArcMemo, Memo},
|
||||
|
@ -192,6 +192,7 @@ pub(crate) fn use_resolved_path<R: Renderer + 'static>(
|
|||
) -> ArcMemo<Option<String>> {
|
||||
let router = use_context::<RouterContext>()
|
||||
.expect("called use_resolved_path outside a <Router>");
|
||||
// TODO make this work with flat routes too?
|
||||
let matched = use_context::<RouteContext<R>>().map(|route| route.matched);
|
||||
ArcMemo::new(move |_| {
|
||||
let path = path();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#![cfg_attr(feature = "nightly", feature(negative_impls))]
|
||||
|
||||
pub mod components;
|
||||
mod flat_router;
|
||||
pub mod flat_router;
|
||||
mod generate_route_list;
|
||||
pub mod hooks;
|
||||
mod link;
|
||||
|
@ -11,18 +11,16 @@ pub mod location;
|
|||
mod matching;
|
||||
mod method;
|
||||
mod navigate;
|
||||
mod nested_router;
|
||||
pub mod nested_router;
|
||||
pub mod params;
|
||||
//mod router;
|
||||
mod ssr_mode;
|
||||
mod static_route;
|
||||
|
||||
pub use flat_router::*;
|
||||
pub use generate_route_list::*;
|
||||
pub use matching::*;
|
||||
pub use method::*;
|
||||
pub use navigate::*;
|
||||
pub use nested_router::*;
|
||||
//pub use router::*;
|
||||
pub use ssr_mode::*;
|
||||
pub use static_route::*;
|
||||
|
|
|
@ -42,10 +42,6 @@ use tachys::{
|
|||
},
|
||||
};
|
||||
|
||||
pub struct Outlet<R> {
|
||||
rndr: PhantomData<R>,
|
||||
}
|
||||
|
||||
pub(crate) struct NestedRoutesView<Loc, Defs, Fal, R> {
|
||||
pub location: Option<Loc>,
|
||||
pub routes: Routes<Defs, R>,
|
||||
|
|
Loading…
Reference in New Issue