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