@colyseus/schema 3.0.0-alpha.16 → 3.0.0-alpha.17

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.
@@ -4234,12 +4234,18 @@ class StateView {
4234
4234
  console.warn("StateView#add(), invalid object:", obj);
4235
4235
  return this;
4236
4236
  }
4237
+ // FIXME: ArraySchema/MapSchema does not have metadata
4238
+ const metadata = obj.constructor[Symbol.metadata];
4237
4239
  let changeTree = obj[$changes];
4238
4240
  this.items.add(changeTree);
4239
4241
  // Add children of this ChangeTree to this view
4240
- changeTree.forEachChild((change, _) => this.add(change.ref, tag));
4241
- // FIXME: ArraySchema/MapSchema does not have metadata
4242
- const metadata = obj.constructor[Symbol.metadata];
4242
+ changeTree.forEachChild((change, index) => {
4243
+ // Do not ADD children that don't have the same tag
4244
+ if (metadata && metadata[metadata[index]].tag !== tag) {
4245
+ return;
4246
+ }
4247
+ this.add(change.ref, tag);
4248
+ });
4243
4249
  // add parent ChangeTree's, if they are invisible to this view
4244
4250
  // TODO: REFACTOR addParent()
4245
4251
  this.addParent(changeTree, tag);
@@ -4266,7 +4272,6 @@ class StateView {
4266
4272
  tags = this.tags.get(changeTree);
4267
4273
  }
4268
4274
  tags.add(tag);
4269
- // console.log("BY TAG:", tag);
4270
4275
  // Ref: add tagged properties
4271
4276
  metadata?.[-3]?.[tag]?.forEach((index) => {
4272
4277
  if (changeTree.getChange(index) !== exports.OPERATION.DELETE) {