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:
1 parent
c56bac04f4
commit
c29cef4ea3
40 files changed
+466
-697
No files matched your search
@@ -1,6 +1,6 @@
|
||||
use dioxus_core::provide_context;
|
||||
use dioxus_core::queue_effect;
|
||||
use dioxus_core::ScopeId;
|
||||
use dioxus_core::{provide_context, Runtime};
|
||||
use dioxus_document::{
|
||||
Document, Eval, EvalError, Evaluator, LinkProps, MetaProps, ScriptProps, StyleProps,
|
||||
};
|
||||
@@ -69,8 +69,7 @@ extern "C" {
|
||||
|
||||
fn init_document_with(document: impl FnOnce(), history: impl FnOnce()) {
|
||||
use dioxus_core::has_context;
|
||||
|
||||
ScopeId::ROOT.in_runtime(|| {
|
||||
Runtime::current().in_scope(ScopeId::ROOT, || {
|
||||
if has_context::<Rc<dyn Document>>().is_none() {
|
||||
document();
|
||||
}
|
||||
@@ -80,7 +79,7 @@ fn init_document_with(document: impl FnOnce(), history: impl FnOnce()) {
|
||||
})
|
||||
}
|
||||
|
||||
/// Provides the Document through [`ScopeId::provide_context`].
|
||||
/// Provides the Document through [`dioxus_core::provide_context`].
|
||||
pub fn init_document() {
|
||||
// If hydrate is enabled, we add the FullstackWebDocument with the initial hydration data
|
||||
#[cfg(not(feature = "hydrate"))]
|
||||
|
||||
Reference in new issue
Block a user