@colyseus/schema 3.0.46 → 3.0.48

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.
@@ -2801,6 +2801,12 @@ class MapSchema {
2801
2801
  this.$indexes.delete(index);
2802
2802
  }
2803
2803
  [$onEncodeEnd]() {
2804
+ const changeTree = this[$changes];
2805
+ // cleanup changeTree.indexes of deleted keys
2806
+ for (const indexStr in this.deletedItems) {
2807
+ const key = this.$indexes.get(parseInt(indexStr));
2808
+ delete changeTree.indexes[key];
2809
+ }
2804
2810
  this.deletedItems = {};
2805
2811
  }
2806
2812
  toJSON() {
@@ -5162,7 +5168,7 @@ class StateView {
5162
5168
  if (tag === DEFAULT_VIEW_TAG) {
5163
5169
  // parent is collection (Map/Array)
5164
5170
  const parent = changeTree.parent;
5165
- if (!Metadata.isValidInstance(parent) && changeTree.isFiltered) {
5171
+ if (parent && !Metadata.isValidInstance(parent) && changeTree.isFiltered) {
5166
5172
  const parentChangeTree = parent[$changes];
5167
5173
  let changes = this.changes.get(parentChangeTree.refId);
5168
5174
  if (changes === undefined) {