mirror of
https://github.com/penpot/penpot.git
synced 2026-10-29 14:00:37 +00:00
A branch derives its document from main's base snapshot, and the derive never re-pointed main's ids: :data :id stayed main's, and so did every inherited reference to the file itself (component instances, library colour and typography refs). The branch workspace then took its own components for an external library it never loads and read its own tokens through main: validation reported :component-main-external and :component-not-found on a fresh branch, the local component sync skipped inherited copies, an update from main refused once the branch held its own copy of a base component, and materialize detached the main instance of every inherited component. The derive now sets the branch's id on the document before the replay, so a change or migration comparing a reference with the document's id sees the branch, and re-routes main's id to the branch's after it, so op log rows written before this fix are covered too. The base keeps main's ids because it shares main's fragments; comparisons already map the branch's id back to main's. relink-refs rebuilds a collection only when something inside it changed (median 803 ms instead of 1506 ms on a 90,612-shape file), and it now relinks the :ref-file of shadow and grid colours, the key migration 0015 gave them, which it had missed since. AI-assisted-by: claude-opus-5-5