summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2025-02-25 13:47:41 +0100
committerGitHub <noreply@github.com>2025-02-25 12:47:41 +0000
commitf31c9716240eb5c81ae225455c069089088015bc (patch)
tree8258ea501fedf096413907f1039f8119903eec79 /crates
parentacd3a5b7a5999d22fbf2da488744d564b2f3638e (diff)
Deduplicate watcher update call (#5955)
Diffstat (limited to 'crates')
-rw-r--r--crates/typst-cli/src/watch.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/crates/typst-cli/src/watch.rs b/crates/typst-cli/src/watch.rs
index cc727f0f..0813d8ff 100644
--- a/crates/typst-cli/src/watch.rs
+++ b/crates/typst-cli/src/watch.rs
@@ -55,11 +55,11 @@ pub fn watch(timer: &mut Timer, command: &WatchCommand) -> StrResult<()> {
// Perform initial compilation.
timer.record(&mut world, |world| compile_once(world, &mut config))??;
- // Watch all dependencies of the initial compilation.
- watcher.update(world.dependencies())?;
-
// Recompile whenever something relevant happens.
loop {
+ // Watch all dependencies of the most recent compilation.
+ watcher.update(world.dependencies())?;
+
// Wait until anything relevant happens.
watcher.wait()?;
@@ -71,9 +71,6 @@ pub fn watch(timer: &mut Timer, command: &WatchCommand) -> StrResult<()> {
// Evict the cache.
comemo::evict(10);
-
- // Adjust the file watching.
- watcher.update(world.dependencies())?;
}
}