Skip to content

Commit 024285c

Browse files
authored
fix: don't send hot-reload if app is building (#3607)
1 parent 6c907b1 commit 024285c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

packages/cli/src/build/builder.rs

+5
Original file line numberDiff line numberDiff line change
@@ -315,4 +315,9 @@ impl Builder {
315315
_ => false,
316316
}
317317
}
318+
319+
/// Check if the queued build is blocking hotreloads
320+
pub(crate) fn can_receive_hotreloads(&self) -> bool {
321+
matches!(&self.stage, BuildStage::Success)
322+
}
318323
}

packages/cli/src/serve/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ pub(crate) async fn serve_all(mut args: ServeArgs) -> Result<()> {
9393
// and then send that update to all connected clients
9494
if let Some(hr) = runner.attempt_hot_reload(files).await {
9595
// Only send a hotreload message for templates and assets - otherwise we'll just get a full rebuild
96-
if hr.templates.is_empty()
97-
&& hr.assets.is_empty()
98-
&& hr.unknown_files.is_empty()
99-
{
96+
//
97+
// Also make sure the builder isn't busy since that might cause issues with hotreloads
98+
// https://github.com/DioxusLabs/dioxus/issues/3361
99+
if hr.is_empty() || !builder.can_receive_hotreloads() {
100100
tracing::debug!(dx_src = ?TraceSrc::Dev, "Ignoring file change: {}", file);
101101
continue;
102102
}

0 commit comments

Comments
 (0)