From 2d1a7b067b6437bb4b5ee3f715aa2b356ebccae2 Mon Sep 17 00:00:00 2001
From: Kevin Jahns <kevin.jahns@rwth-aachen.de>
Date: Tue, 26 Apr 2016 21:27:08 +0200
Subject: [PATCH] fixed some minor problems related to compareId

---
 src/Utils.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/Utils.js b/src/Utils.js
index 08beef87..d2bbf288 100644
--- a/src/Utils.js
+++ b/src/Utils.js
@@ -115,13 +115,15 @@ module.exports = function (Y /* : any*/) {
         if (op.struct === 'Insert') {
           for (var i = this.waiting.length - 1; i >= 0; i--) {
             let w = this.waiting[i]
+            // TODO: do I handle split operations correctly here? Super unlikely, but yeah.. 
+            // Also: can this case happen? Can op be inserted in the middle of a larger op that is in $waiting? 
             if (w.struct === 'Insert') {
-              if (Y.utils.compareIds(op.left, w.id)) {
+              if (Y.utils.matchesId(w, op.left)) {
                 // include the effect of op in w
                 w.right = op.id
                 // exclude the effect of w in op
                 op.left = w.left
-              } else if (Y.utils.compareIds(op.right, w.id)) {
+              } else if (Y.utils.matchesId(w, op.right)) {
                 // similar..
                 w.left = op.id
                 op.right = w.right
-- 
GitLab