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

+3 -3
View File
@@ -22,13 +22,13 @@ pub fn use_wry_event_handler(
use dioxus_core::current_scope_id;
// Capture the current runtime and scope ID.
let runtime = Runtime::current().unwrap();
let scope_id = current_scope_id().unwrap();
let runtime = Runtime::current();
let scope_id = current_scope_id();
use_hook_with_cleanup(
move || {
window().create_wry_event_handler(move |event, target| {
runtime.on_scope(scope_id, || handler(event, target))
runtime.in_scope(scope_id, || handler(event, target))
})
},
move |handler| handler.remove(),