From 5fafe9f558e1537e6bd0abd4c4901bd4219faebf Mon Sep 17 00:00:00 2001 From: logicalDust <39096469+logicalDust@users.noreply.github.com> Date: Tue, 11 Jun 2019 18:44:29 +0200 Subject: [PATCH] Hotfix of remove method Rare bug could happen when removing and linking element back to tree in index method. Index method was returning cached value instead of recomputing the index if the element had previously same cachedIndexVersion as new parent had childrenVersion. In this fix we are purging cachedIndexVersion in remove method as removed elements doesnt belong to any children collection anyway. --- lib/SymbolTree.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/SymbolTree.js b/lib/SymbolTree.js index a4e596a..667cde9 100644 --- a/lib/SymbolTree.js +++ b/lib/SymbolTree.js @@ -669,6 +669,8 @@ class SymbolTree { removeNode.parent = null; removeNode.previousSibling = null; removeNode.nextSibling = null; + removeNode.cachedIndex = -1; + removeNode.cachedIndexVersion = NaN; if (parentNode) { parentNode.childrenChanged();