Skip to content

Commit

Permalink
enhance: avoid failed hot-reload if backup file like .rs~ generate (#…
Browse files Browse the repository at this point in the history
…2048)

(cherry picked from commit 8565bca)

Co-authored-by: Jeremy Chen <jeremychen@djeremychen.com>
  • Loading branch information
JryChn and Jeremy Chen authored Mar 11, 2024
1 parent 60235ac commit 70f97ec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/cli/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,13 @@ async fn setup_file_watcher<F: Fn() -> Result<BuildResult> + Send + 'static>(

for path in &e.paths {
// if this is not a rust file, rebuild the whole project
if path.extension().and_then(|p| p.to_str()) != Some("rs") {
let path_extension = path.extension().and_then(|p| p.to_str());
if path_extension != Some("rs") {
needs_full_rebuild = true;
// if backup file generated will impact normal hot-reload, so ignore it
if path_extension == Some("rs~") {
needs_full_rebuild = false;
}
break;
}

Expand Down

0 comments on commit 70f97ec

Please sign in to comment.