move ScopeId methods to the runtime (#4723)

* move `ScopeId` methods to runtime methods

* cargo check unused

* wip...

* wip...

* fix consume context

* fix test

* guard hoisted

* fix doc comment
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2025-10-04 01:55:52 -07:00
1 parent c56bac04f4
commit c29cef4ea3
40 files changed
+466 -697

No files matched your search

+4 -5
View File
@@ -1,8 +1,8 @@
#![allow(clippy::unnecessary_operation)]
#![allow(clippy::no_effect)]
use dioxus_core::Subscribers;
use dioxus_core::{current_owner, current_scope_id, ScopeId};
use dioxus_core::{Runtime, Subscribers};
use generational_box::{
AnyStorage, BorrowResult, GenerationalBox, GenerationalBoxId, Storage, UnsyncStorage,
};
@@ -82,7 +82,7 @@ impl<T, S: Storage<T>> CopyValue<T, S> {
{
Self {
value: GenerationalBox::leak(value, caller),
origin_scope: current_scope_id().expect("in a virtual dom"),
origin_scope: current_scope_id(),
}
}
@@ -99,7 +99,7 @@ impl<T, S: Storage<T>> CopyValue<T, S> {
Self {
value: owner.insert_rc_with_caller(value, caller),
origin_scope: current_scope_id().expect("in a virtual dom"),
origin_scope: current_scope_id(),
}
}
@@ -116,8 +116,7 @@ impl<T, S: Storage<T>> CopyValue<T, S> {
scope: ScopeId,
caller: &'static std::panic::Location<'static>,
) -> Self {
let owner = scope.owner();
let owner = Runtime::current().scope_owner(scope);
Self {
value: owner.insert_rc_with_caller(value, caller),
origin_scope: scope,