You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Draft list: a stale tab writes its old metadata.releases back #8569
A project's draft list (metadata.releases on the virtual MCP) is written whole by whichever tab acts last, from that tab's cached copy. A tab opened before another change writes its old list back, so:
drafts that were discarded come back (pointing at branches that no longer exist), and
drafts other people created in the meantime disappear from the list (their branch stays, unlisted).
Seen on a production project: 23 discarded drafts were removed; hours later two editors created drafts from tabs opened before the removal, and the list went back to 25 entries, 18 of them on deleted branches. A draft another editor had created in between was no longer listed.
Why
useReleases().write (apps/web/src/components/thread/repository/use-releases.ts) reads the list from the tab's react-query cache (readCacheReleases), applies the edit and sends the full array. COLLECTION_VIRTUAL_MCP_UPDATE merges metadata shallowly, so releases is replaced as sent. The comment there covers two writers in the same tab (serialized with runSerializedTask); writers in different tabs or by different people are not coordinated, and the last write wins.
Suggested fix
Apply release edits on the server against the stored list instead of sending the array: e.g. RELEASE_CREATE / RELEASE_DELETE / RELEASE_RENAME operations that read and update metadata.releases in one transaction. A smaller step: compare-and-swap on the entity's updated_at and, on conflict, refetch and reapply the reducer.
How to reproduce
Open a project's Site Editor in tab A.
In tab B, discard a draft (or remove entries from metadata.releases).
Activity