@colyseus/schema 5.0.23 → 5.0.25

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.
package/build/index.js CHANGED
@@ -8934,7 +8934,18 @@
8934
8934
  changes = new Map();
8935
8935
  this.changes.set(changeTree.ref[$refId], changes);
8936
8936
  }
8937
- this.addTag(changeTree, tag);
8937
+ // Grant the tag on the parent only when the field pointing at
8938
+ // the child carries an overlapping tag — that field is the sole
8939
+ // reason the parent needs it. Granting unconditionally handed
8940
+ // the view every OTHER same-tag field on the parent, which then
8941
+ // rode out on its next mutation (never at add() time, so it read
8942
+ // as "the field only shows up after it changes").
8943
+ const parentFieldTag = changeTree.encDescriptor.tags[parentIndex];
8944
+ if (parentFieldTag !== undefined &&
8945
+ parentFieldTag !== DEFAULT_VIEW_TAG &&
8946
+ (parentFieldTag & tag) !== 0) {
8947
+ this.addTag(changeTree, tag);
8948
+ }
8938
8949
  // ArraySchema parents: key by the child's identity, not the wire
8939
8950
  // slot it holds right now — a same-tick unshift()/reverse()/move()
8940
8951
  // would shift the slot before encodeView drains this entry. Other
package/build/index.mjs CHANGED
@@ -8928,7 +8928,18 @@ class StateView {
8928
8928
  changes = new Map();
8929
8929
  this.changes.set(changeTree.ref[$refId], changes);
8930
8930
  }
8931
- this.addTag(changeTree, tag);
8931
+ // Grant the tag on the parent only when the field pointing at
8932
+ // the child carries an overlapping tag — that field is the sole
8933
+ // reason the parent needs it. Granting unconditionally handed
8934
+ // the view every OTHER same-tag field on the parent, which then
8935
+ // rode out on its next mutation (never at add() time, so it read
8936
+ // as "the field only shows up after it changes").
8937
+ const parentFieldTag = changeTree.encDescriptor.tags[parentIndex];
8938
+ if (parentFieldTag !== undefined &&
8939
+ parentFieldTag !== DEFAULT_VIEW_TAG &&
8940
+ (parentFieldTag & tag) !== 0) {
8941
+ this.addTag(changeTree, tag);
8942
+ }
8932
8943
  // ArraySchema parents: key by the child's identity, not the wire
8933
8944
  // slot it holds right now — a same-tick unshift()/reverse()/move()
8934
8945
  // would shift the slot before encodeView drains this entry. Other