finish fixing router
This commit is contained in:
1 parent
adf67b4384
commit
ecf17b351c
2 files changed
+1
-5
No files matched your search
@@ -12,16 +12,14 @@ use crate::prelude::*;
|
||||
/// - Otherwise [`Some`].
|
||||
pub(crate) fn use_router_internal() -> Option<RouterContext> {
|
||||
let router = use_hook(consume_context::<RouterContext>);
|
||||
let id = current_scope_id().expect("use_router_internal called outside of a component");
|
||||
use_on_destroy({
|
||||
to_owned![router];
|
||||
move || {
|
||||
let id = current_scope_id().expect("use_router_internal called outside of a component");
|
||||
|
||||
router.unsubscribe(id);
|
||||
}
|
||||
});
|
||||
use_hook(move || {
|
||||
let id = current_scope_id().expect("use_router_internal called outside of a component");
|
||||
router.subscribe(id);
|
||||
|
||||
Some(router)
|
||||
|
||||
Reference in new issue
Block a user