@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.
@@ -2799,10 +2799,15 @@ class MapSchema {
2799
2799
  }
2800
2800
  [$onEncodeEnd]() {
2801
2801
  const changeTree = this[$changes];
2802
- // cleanup changeTree.indexes of deleted keys
2802
+ // - cleanup changeTree.indexes
2803
+ // - cleanup $indexes
2803
2804
  for (const indexStr in this.deletedItems) {
2804
- const key = this.$indexes.get(parseInt(indexStr));
2805
+ const index = parseInt(indexStr);
2806
+ const key = this.$indexes.get(index);
2807
+ // TODO: refactor this.
2808
+ // it shouldn't be necessary to keep track of indexes both on changeTree and on $indexes
2805
2809
  delete changeTree.indexes[key];
2810
+ this.$indexes.delete(index);
2806
2811
  }
2807
2812
  this.deletedItems = {};
2808
2813
  }