Merge branch 'master' into return-from-js

This commit is contained in:
Jon Kelley authored and GitHub committed 2022-12-09 13:19:05 -08:00
commit 051f85f78f
17 files changed
+405 -289

No files matched your search

+6 -6
View File
@@ -56,8 +56,7 @@
pub use crate::cfg::Config;
use crate::dom::virtual_event_from_websys_event;
pub use crate::util::{use_eval, EvalResult};
use dioxus_core::VirtualDom;
use dioxus_core::{Element, ElementId, Scope};
use dioxus_core::{Element, ElementId, Scope, VirtualDom};
use futures_util::{pin_mut, FutureExt, StreamExt};
mod cache;
@@ -196,7 +195,7 @@ pub async fn run_with_props<T: 'static>(root: fn(Scope<T>) -> Element, root_prop
// the mutations come back with nothing - we need to actually mount them
websys_dom.mount();
let mut work_loop = ric_raf::RafLoop::new();
let _work_loop = ric_raf::RafLoop::new();
loop {
log::debug!("waiting for work");
@@ -229,6 +228,7 @@ pub async fn run_with_props<T: 'static>(root: fn(Scope<T>) -> Element, root_prop
res = rx.try_next().transpose().unwrap().ok();
}
// Todo: This is currently disabled because it has a negative impact on responce times for events but it could be re-enabled for tasks
// Jank free rendering
//
// 1. wait for the browser to give us "idle" time
@@ -237,13 +237,13 @@ pub async fn run_with_props<T: 'static>(root: fn(Scope<T>) -> Element, root_prop
// 4. Wait for the animation frame to patch the dom
// wait for the mainthread to schedule us in
let deadline = work_loop.wait_for_idle_time().await;
// let deadline = work_loop.wait_for_idle_time().await;
// run the virtualdom work phase until the frame deadline is reached
let edits = dom.render_with_deadline(deadline).await;
let edits = dom.render_immediate();
// wait for the animation frame to fire so we can apply our changes
work_loop.wait_for_raf().await;
// work_loop.wait_for_raf().await;
websys_dom.load_templates(&edits.templates);
websys_dom.apply_edits(edits.edits);