From 1b1e3e3e1700bd329159c2edf43e52f5fd2bd3a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Ma=C4=87kowski?= Date: Sat, 17 Jan 2026 00:44:35 +0000 Subject: [PATCH] fix: `serve_subsecond` looping when devtools do not connect (#5158) Currently when `serve_subsecond` is used and the user doesn't run the app with `dx serve --hot-patching`, the function causes the future to be constantly recreated in a loop. This fixes the behavior so that the future is awaited once and then `serve_subsecond` returns. --- packages/devtools/src/lib.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/devtools/src/lib.rs b/packages/devtools/src/lib.rs index aae88fc4b..2083ff299 100644 --- a/packages/devtools/src/lib.rs +++ b/packages/devtools/src/lib.rs @@ -204,7 +204,15 @@ where match res { futures_util::future::Either::Left(_completed) => _ = rx.next().await, - futures_util::future::Either::Right(_reload) => {} + futures_util::future::Either::Right((None, callback)) => { + // Receiving `None` here means that the sender is not connected, which + // typically means the dioxus devtools protocol has never connected. + // We want to run the future to completion and return instead of + // re-running the future constantly in the loop. + callback.await; + return; + } + futures_util::future::Either::Right((Some(_), _)) => {} } cur_future = hotfn.call((args.clone(),));