Browse Source

NodeDeletion: Fix bug (wrongly detect conflict when deleting a node with a self-edge)

Joeri Exelmans 2 years ago
parent
commit
9aa1db9b80
1 changed files with 10 additions and 4 deletions
  1. 10 4
      src/onion/primitive_delta.ts

+ 10 - 4
src/onion/primitive_delta.ts

@@ -182,10 +182,16 @@ export class NodeDeletion implements PrimitiveDelta {
     // Related to previous conflict type: Concurrent edge updates
     for (const deletedEdge of this.deletedOutgoingEdges) {
       for (const concurrentEdgeUpdate of deletedEdge.overwrittenBy) {
-        // Conflict: Edge concurrently updated and deleted.
-        // Symmetric
-        this.updateConflicts.push(concurrentEdgeUpdate);
-        concurrentEdgeUpdate.updateConflicts.push(this);
+        if (this.afterIncomingEdges.includes(concurrentEdgeUpdate)) {
+          // This is a special case that can occur when a node with a self-edge is deleted.
+          // Not a conflict.
+        }
+        else {
+          // Conflict: Edge concurrently updated and deleted.
+          // Symmetric
+          this.updateConflicts.push(concurrentEdgeUpdate);
+          concurrentEdgeUpdate.updateConflicts.push(this);
+        }
       }
     }