Fix: requeue events, process events (#2236)

* Fix: requeue events, process events

* Fix test: wait_for_work shouldn't wait 3 times when one update happens while rendering
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2024-04-04 11:46:31 -07:00
1 parent 4d25e3f6a2
commit 821a650f77
2 files changed
+17 -8

No files matched your search

+3 -6
View File
@@ -29,15 +29,13 @@ async fn memo_updates() {
if generation() < 2 {
vec.push(len);
}
// The memo should always be up to date
assert_eq!(vec.len(), len_memo());
rsx! {
for i in 0..len {
Child {
index: i,
vec,
}
Child { index: i, vec }
}
}
}
@@ -57,10 +55,9 @@ async fn memo_updates() {
dom.rebuild_in_place();
let mut signal = VEC_SIGNAL.with(|cell| (*cell.borrow()).unwrap());
// Wait for the signal to update
for _ in 0..3 {
for _ in 0..2 {
dom.wait_for_work().await;
dom.render_immediate(&mut dioxus::dioxus_core::NoOpMutations);
println!("Signal: {signal:?}");
}
assert_eq!(signal(), vec![0, 1, 2, 3, 4, 5]);
// Remove each element from the vec