@colyseus/schema 3.0.59 → 3.0.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2797,10 +2797,15 @@ class MapSchema {
2797
2797
  }
2798
2798
  [$onEncodeEnd]() {
2799
2799
  const changeTree = this[$changes];
2800
- // cleanup changeTree.indexes of deleted keys
2800
+ // - cleanup changeTree.indexes
2801
+ // - cleanup $indexes
2801
2802
  for (const indexStr in this.deletedItems) {
2802
- const key = this.$indexes.get(parseInt(indexStr));
2803
+ const index = parseInt(indexStr);
2804
+ const key = this.$indexes.get(index);
2805
+ // TODO: refactor this.
2806
+ // it shouldn't be necessary to keep track of indexes both on changeTree and on $indexes
2803
2807
  delete changeTree.indexes[key];
2808
+ this.$indexes.delete(index);
2804
2809
  }
2805
2810
  this.deletedItems = {};
2806
2811
  }