@colyseus/schema 3.0.34 → 3.0.36

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.
@@ -4212,7 +4212,7 @@ class ReferenceTracker {
4212
4212
  }
4213
4213
  removeCallback(refId, field, callback) {
4214
4214
  const index = this.callbacks?.[refId]?.[field]?.indexOf(callback);
4215
- if (index !== -1) {
4215
+ if (index !== undefined && index !== -1) {
4216
4216
  spliceOne(this.callbacks[refId][field], index);
4217
4217
  }
4218
4218
  }
@@ -4978,7 +4978,7 @@ class StateView {
4978
4978
  if (tag === DEFAULT_VIEW_TAG) {
4979
4979
  // parent is collection (Map/Array)
4980
4980
  const parent = changeTree.parent;
4981
- if (!Metadata.isValidInstance(parent)) {
4981
+ if (!Metadata.isValidInstance(parent) && changeTree.isFiltered) {
4982
4982
  const parentChangeTree = parent[$changes];
4983
4983
  let changes = this.changes.get(parentChangeTree.refId);
4984
4984
  if (changes === undefined) {
@@ -4990,7 +4990,7 @@ class StateView {
4990
4990
  }
4991
4991
  else {
4992
4992
  // delete all "tagged" properties.
4993
- metadata?.[$viewFieldIndexes].forEach((index) => changes[index] = OPERATION.DELETE);
4993
+ metadata?.[$viewFieldIndexes]?.forEach((index) => changes[index] = OPERATION.DELETE);
4994
4994
  }
4995
4995
  }
4996
4996
  else {