Move the history provider into the context (#3048)
* move history providers into a separate crate * start moving route providers into the renderers * clean up intoroutable * remove into routable * fix router tests * Provide history providers in each renderer * implement nested routers * move the lens out of the history crate * re-export dioxus history trait in the prelude * also re-export the history function * fix history doctests * some light cleanups --------- Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
1 parent
e5a1a62644
commit
281087469a
48 files changed
+875
-1419
No files matched your search
@@ -11,17 +11,5 @@ use crate::prelude::*;
|
||||
/// - [`None`], when the current component isn't a descendant of a [`Router`] component.
|
||||
/// - Otherwise [`Some`].
|
||||
pub(crate) fn use_router_internal() -> Option<RouterContext> {
|
||||
let router = try_consume_context::<RouterContext>()?;
|
||||
let id = current_scope_id().expect("use_router_internal called outside of a component");
|
||||
use_drop({
|
||||
to_owned![router];
|
||||
move || {
|
||||
router.unsubscribe(id);
|
||||
}
|
||||
});
|
||||
use_hook(move || {
|
||||
router.subscribe(id);
|
||||
|
||||
Some(router)
|
||||
})
|
||||
use_hook(try_consume_context)
|
||||
}
|
||||
Reference in new issue
Block a user