Explorar el Código

fix: enable/disable hot reload (#2737)

Miles Murgaw hace 11 meses
padre
commit
67c0f1c5f0
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      packages/cli/src/serve/mod.rs

+ 3 - 1
packages/cli/src/serve/mod.rs

@@ -55,6 +55,8 @@ pub async fn serve_all(serve: Serve, dioxus_crate: DioxusCrate) -> Result<()> {
     let mut watcher = Watcher::start(&serve, &dioxus_crate);
     let mut screen = Output::start(&serve).expect("Failed to open terminal logger");
 
+    let is_hot_reload = serve.server_arguments.hot_reload.unwrap_or(true);
+
     loop {
         // Make sure we don't hog the CPU: these loop { select! {} } blocks can starve the executor
         yield_now().await;
@@ -65,7 +67,7 @@ pub async fn serve_all(serve: Serve, dioxus_crate: DioxusCrate) -> Result<()> {
         // And then wait for any updates before redrawing
         tokio::select! {
             // rebuild the project or hotreload it
-            _ = watcher.wait() => {
+            _ = watcher.wait(), if is_hot_reload => {
                 if !watcher.pending_changes() {
                     continue
                 }