SlotCell::accessed (world.rs:225) is set to true on first access and is never reset. There is no per-compile file-slot reset anywhere in the crate, only reset_time() for the clock.
So a compiler created with FromFile caches the source and every import from its first compile and keeps serving them for the lifetime of the object. Rewriting the .typ on disk and compiling again returns the old output, with no error.
That matters because reusing one compiler across renders is the recommended pattern - the README suggests caching it to get a compile from 40ms down to around 3ms. Anyone who does that and also reloads templates gets silently stale output.
Two ways out: reset the file slots at the start of each compile, which is what typst-cli does between watch runs, or document that a compiler pins its inputs at first compile and has to be recreated when a template changes.
SlotCell::accessed(world.rs:225) is set totrueon first access and is never reset. There is no per-compile file-slot reset anywhere in the crate, onlyreset_time()for the clock.So a compiler created with
FromFilecaches the source and every import from its first compile and keeps serving them for the lifetime of the object. Rewriting the.typon disk and compiling again returns the old output, with no error.That matters because reusing one compiler across renders is the recommended pattern - the README suggests caching it to get a compile from 40ms down to around 3ms. Anyone who does that and also reloads templates gets silently stale output.
Two ways out: reset the file slots at the start of each compile, which is what
typst-clidoes between watch runs, or document that a compiler pins its inputs at first compile and has to be recreated when a template changes.