Skip to content

A reused TypstCompiler never picks up changes to files on disk #28

Description

@msallin

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions