From c0269265c27db67778caa0a97ea74474958e3913 Mon Sep 17 00:00:00 2001 From: FabianLars Date: Tue, 7 Jan 2025 20:14:02 +0100 Subject: [PATCH] fix(cli): Skip File Access events in dev server --- .changes/fix-cli-dev-server-reload.md | 6 ++++++ crates/tauri-cli/src/dev/builtin_dev_server.rs | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 .changes/fix-cli-dev-server-reload.md diff --git a/.changes/fix-cli-dev-server-reload.md b/.changes/fix-cli-dev-server-reload.md new file mode 100644 index 000000000000..c4349f1d25ba --- /dev/null +++ b/.changes/fix-cli-dev-server-reload.md @@ -0,0 +1,6 @@ +--- +tauri-cli: 'patch:bug' +'@tauri-apps/cli': 'patch:bug' +--- + +Fixed an issue that caused the built-in dev server to constantly refresh on Linux. This only affected users who do not have `devUrl` point to a URL. diff --git a/crates/tauri-cli/src/dev/builtin_dev_server.rs b/crates/tauri-cli/src/dev/builtin_dev_server.rs index 9f51f2d74ca7..7873ea2aa14a 100644 --- a/crates/tauri-cli/src/dev/builtin_dev_server.rs +++ b/crates/tauri-cli/src/dev/builtin_dev_server.rs @@ -170,8 +170,12 @@ fn watch(dir: PathBuf, handler: F) { .expect("builtin server failed to watch dir"); loop { - if rx.recv().is_ok() { - handler(); + if let Ok(Ok(event)) = rx.recv() { + if let Some(event) = event.first() { + if !event.kind.is_access() { + handler(); + } + } } } });