From 01a50cdcaa7ff8061a5a49f64427109cf2bfb3ef Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Mon, 14 Jul 2025 17:53:30 -0700 Subject: [PATCH] Fix: drop pollster in lieu of std::sync::mpsc --- Cargo.lock | 1 - packages/desktop/Cargo.toml | 1 - packages/desktop/src/edits.rs | 14 ++++++-------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 98655e449..f92ecc6f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5319,7 +5319,6 @@ dependencies = [ "objc_id", "openssl", "percent-encoding", - "pollster", "rand 0.9.1", "reqwest 0.12.22", "rfd", diff --git a/packages/desktop/Cargo.toml b/packages/desktop/Cargo.toml index dc2840e97..6beeafeff 100644 --- a/packages/desktop/Cargo.toml +++ b/packages/desktop/Cargo.toml @@ -48,7 +48,6 @@ tao = { workspace = true, features = ["rwh_05"] } dioxus-history = { workspace = true } base64 = { workspace = true } libc = "0.2.174" -pollster = "0.4.0" rand = { workspace = true, features = ["std_rng"] } subtle = { version = "2.6", features = ["const-generics"] } webbrowser = { version = "1.0" } diff --git a/packages/desktop/src/edits.rs b/packages/desktop/src/edits.rs index a5f53a207..8112a17bf 100644 --- a/packages/desktop/src/edits.rs +++ b/packages/desktop/src/edits.rs @@ -19,10 +19,8 @@ //! and key. The webview will then reconnect to the new port and continue receiving edits. use dioxus_interpreter_js::MutationState; -use futures_channel::mpsc::UnboundedSender; use futures_channel::oneshot; -use futures_util::{FutureExt, StreamExt}; -use pollster::FutureExt as _; +use futures_util::FutureExt; use rand::{RngCore, SeedableRng}; use std::cell::RefCell; use std::collections::{HashMap, VecDeque}; @@ -299,14 +297,14 @@ impl EditWebsocket { }; // Handle the websocket connection in a separate thread - let (edits_outgoing, mut edits_incoming_rx) = futures_channel::mpsc::unbounded::(); + let (edits_outgoing, edits_incoming_rx) = std::sync::mpsc::channel::(); let connections_ = connections.clone(); // Spawn a task to handle the websocket connection std::thread::spawn(move || { let mut queued_message = None; // Wait until there are edits ready to send - 'connection: while let Some(msg) = edits_incoming_rx.next().block_on() { + 'connection: while let Ok(msg) = edits_incoming_rx.recv() { let data = msg.edits.clone(); queued_message = Some(msg); // Send the edits to the webview @@ -353,7 +351,7 @@ impl EditWebsocket { // If there are pending edits, send them to the new connection Some(WebviewConnectionState::Pending { mut pending }) => { while let Some(pair) = pending.pop_front() { - _ = edits_outgoing.unbounded_send(pair); + _ = edits_outgoing.send(pair); } } @@ -408,7 +406,7 @@ enum WebviewConnectionState { pending: VecDeque, }, Connected { - edits_outgoing: UnboundedSender, + edits_outgoing: std::sync::mpsc::Sender, }, } @@ -441,7 +439,7 @@ impl WebviewConnectionState { queue.push_back(pair); } WebviewConnectionState::Connected { edits_outgoing } => { - _ = edits_outgoing.unbounded_send(pair); + _ = edits_outgoing.send(pair); } } }