@colyseus/schema 3.0.33 → 3.0.35

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.
@@ -4608,7 +4608,8 @@ function getDecoderStateCallbacks(decoder) {
4608
4608
  }
4609
4609
  }
4610
4610
  }
4611
- else if ((change.op & OPERATION.ADD) === OPERATION.ADD && change.previousValue === undefined) {
4611
+ else if ((change.op & OPERATION.ADD) === OPERATION.ADD &&
4612
+ change.previousValue !== change.value) {
4612
4613
  // triger onAdd
4613
4614
  const addCallbacks = $callbacks[OPERATION.ADD];
4614
4615
  for (let i = addCallbacks?.length - 1; i >= 0; i--) {
@@ -4977,7 +4978,7 @@ class StateView {
4977
4978
  if (tag === DEFAULT_VIEW_TAG) {
4978
4979
  // parent is collection (Map/Array)
4979
4980
  const parent = changeTree.parent;
4980
- if (!Metadata.isValidInstance(parent)) {
4981
+ if (!Metadata.isValidInstance(parent) && changeTree.isFiltered) {
4981
4982
  const parentChangeTree = parent[$changes];
4982
4983
  let changes = this.changes.get(parentChangeTree.refId);
4983
4984
  if (changes === undefined) {
@@ -4989,7 +4990,7 @@ class StateView {
4989
4990
  }
4990
4991
  else {
4991
4992
  // delete all "tagged" properties.
4992
- metadata?.[$viewFieldIndexes].forEach((index) => changes[index] = OPERATION.DELETE);
4993
+ metadata?.[$viewFieldIndexes]?.forEach((index) => changes[index] = OPERATION.DELETE);
4993
4994
  }
4994
4995
  }
4995
4996
  else {