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

+6 -2
View File
@@ -9,9 +9,13 @@ pub fn copy_value_hoisted<T: 'static, S: generational_box::Storage<T> + 'static>
caller: &'static std::panic::Location<'static>,
) {
let origin_scope = value.origin_scope;
if let Ok(current_scope) = dioxus_core::current_scope_id() {
let Some(rt) = dioxus_core::Runtime::try_current() else {
return;
};
if let Some(current_scope) = rt.try_current_scope_id() {
// If the current scope is a descendant of the origin scope or is the same scope, we don't need to warn
if origin_scope == current_scope || current_scope.is_descendant_of(origin_scope) {
if origin_scope == current_scope || rt.is_descendant_of(current_scope, origin_scope) {
return;
}
let create_location = value.value.created_at().unwrap();