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
After a property delete and its undo, the server keeps a value the clients do not have #1313
Alice and Bob edit the same synced graph. A property "stage" has the choices "draft" and "done". Page "page 1" has a block "a".
Alice goes offline.
Alice sets "stage" on block "a" to "draft".
Alice deletes the property "stage".
Alice presses Ctrl+Z.
Bob, online, edits any other block (in the test he sets another block to DONE).
Alice goes online.
Expected
After the sync, Alice, Bob and the server hold the same data.
Actual
The server's copy of block "a" differs from both clients' copies:
On the server, "a" keeps a value of "stage" that points at the deleted choice: the datom [a :user.property/stage 195], where 195 was the id of "draft" and no entity has that id any more.
On Alice's client, and on Bob's after he pulls, "a" has no value of "stage".
The sync checksum does not notice: it covers only :block/uuid, :block/parent, :block/page, :block/order, :block/title and :block/name (relevant-attrs, deps/db-sync/src/logseq/db_sync/checksum.cljs:75-78).
The difference comes from Alice's client applying her 3 unconfirmed requests again after Bob's edit. The rows it then uploads, in order:
[:db/add a :user.property/stage [:block/uuid draft]] (the property value)
[:db/retractEntity stage], [:db/retractEntity done], [:db/retractEntity draft] (the property delete)
the property "stage" and its choices created again with their uuids (the undo)
On Alice's client, retracting "draft" also removes a's value. On the server, after the same rows, a's value is still there and points at the old id of "draft".
Separately, the undo does not give "a" its value back, also without sync (see #1309 for the undo of deleting a property with choices).
Found with a 2-person property-based test of undo under sync (random requests of 2 people, random sync points), replayed on upstream master 16c4ed1a0.
Activity