Provide context on desktop again
This commit is contained in:
3 files changed
+5
-104
No files matched your search
@@ -8,7 +8,7 @@ use crate::{
|
||||
waker::tao_waker,
|
||||
Config, DesktopContext, DesktopService,
|
||||
};
|
||||
use dioxus_core::VirtualDom;
|
||||
use dioxus_core::{ScopeId, VirtualDom};
|
||||
use dioxus_html::prelude::EvalProvider;
|
||||
use futures_util::{pin_mut, FutureExt};
|
||||
use std::{any::Any, rc::Rc, task::Waker};
|
||||
@@ -148,27 +148,13 @@ impl WebviewInstance {
|
||||
asset_handlers,
|
||||
));
|
||||
|
||||
// Provide the desktop context to the virtualdom
|
||||
// dom.base_scope().provide_context(desktop_context.clone());
|
||||
|
||||
// let query = dom.in_runtime(|| {
|
||||
// let query = ScopeId::ROOT.provide_context(desktop_context.clone());
|
||||
// // Init eval
|
||||
// init_eval();
|
||||
// query
|
||||
// });
|
||||
|
||||
// let desktop_ctx = ScopeId::ROOT.consume_context::<DesktopContext>().unwrap();
|
||||
// let provider: Rc<dyn EvalProvider> = Rc::new(DesktopEvalProvider { desktop_ctx });
|
||||
// ScopeId::ROOT.provide_context(provider);
|
||||
|
||||
// Also set up its eval provider
|
||||
// It's important that we provide as dyn EvalProvider - using the concrete type has
|
||||
// a different TypeId and can not be downcasted as dyn EvalProvider
|
||||
let provider: Rc<dyn EvalProvider> =
|
||||
Rc::new(DesktopEvalProvider::new(desktop_context.clone()));
|
||||
|
||||
// dom.base_scope().provide_context(provider);
|
||||
dom.in_runtime(|| {
|
||||
ScopeId::ROOT.provide_context(desktop_context.clone());
|
||||
ScopeId::ROOT.provide_context(provider);
|
||||
});
|
||||
|
||||
WebviewInstance {
|
||||
waker: tao_waker(shared.proxy.clone(), desktop_context.window.id()),
|
||||
@@ -196,8 +182,6 @@ impl WebviewInstance {
|
||||
}
|
||||
}
|
||||
|
||||
// self.desktop_context.send_edits(self.dom.render_immediate());
|
||||
|
||||
self.dom
|
||||
.render_immediate(&mut *self.desktop_context.mutation_state.borrow_mut());
|
||||
self.desktop_context.send_edits();
|
||||
|
||||
Reference in new issue
Block a user