Fix desktop effect race condition (#2313)

* don't poll desktop before the render has been applied

* fix desktop headless tests

* move edit queued code into the edit channel and add more comments
This commit is contained in:
Evan Almloff authored and GitHub committed 2024-04-26 12:52:33 -04:00
1 parent a0e06271dd
commit 74352f2f61
6 files changed
+124 -48

No files matched your search

+7 -1
View File
@@ -229,10 +229,16 @@ impl WebviewInstance {
pub fn poll_vdom(&mut self) {
let mut cx = std::task::Context::from_waker(&self.waker);
// Continously poll the virtualdom until it's pending
// Continuously poll the virtualdom until it's pending
// Wait for work will return Ready when it has edits to be sent to the webview
// It will return Pending when it needs to be polled again - nothing is ready
loop {
// If we're waiting for a render, wait for it to finish before we continue
let edits_flushed_poll = self.desktop_context.edit_queue.poll_edits_flushed(&mut cx);
if edits_flushed_poll.is_pending() {
return;
}
{
let fut = self.dom.wait_for_work();
pin_mut!(fut);