mirror of
https://github.com/penpot/penpot.git
synced 2026-05-14 20:43:55 +00:00
* 🐛 Fix library updates reappear after file is reloaded Summary Migrate synced_at timestamps to a standalone file_library_sync table to ensure sync state is tracked for both direct and transitive libraries. Problem Transitive libraries (libraries imported by other libraries) are not stored as direct rows in file_library_rel. Because the system previously coupled synced_at directly to the file_library_rel schema, transitive libraries lacked a persistent location for their sync timestamps. This caused sync states to be lost or incorrectly reported for nested dependencies. Changes Schema Migration: Created file_library_sync and migrated existing synced_at values from file_library_rel. Decoupling: Removed tight Foreign Key coupling to allow sync rows to exist independently of specific relationship records. Persistent Writes: Added upsert-file-library-sync! helper. Updated all import, duplication, and RPC write paths (v1/v2/v3 importers, link-file-library) to ensure every write persists a sync row. Unified Reads: Updated both direct and recursive/transitive library queries to fetch synced_at from the new table. Testing: Added regression tests to verify that sync rows are correctly created/updated even when a transitive relation is absent in file_library_rel. Impact This fix ensures that the system accurately records and retrieves sync states for the entire library dependency tree, resolving the bug where nested libraries appeared out of sync. * ✨ MR review