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.
This commit is contained in:
Mateusz Maćkowski authored and GitHub committed 2026-01-16 16:44:35 -08:00
1 parent adfd6a12f8
commit 1b1e3e3e17
1 file changed
+9 -1
+9 -1
View File
@@ -204,7 +204,15 @@ where
match res { match res {
futures_util::future::Either::Left(_completed) => _ = rx.next().await, 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(),)); cur_future = hotfn.call((args.clone(),));