@colyseus/schema 3.0.31 → 3.0.33

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.
@@ -1103,8 +1103,14 @@ class ChangeTree {
1103
1103
  operation(op) {
1104
1104
  // operations without index use negative values to represent them
1105
1105
  // this is checked during .encode() time.
1106
- this.changes.operations.push(-op);
1107
- enqueueChangeTree(this.root, this, 'changes');
1106
+ if (this.filteredChanges !== undefined) {
1107
+ this.filteredChanges.operations.push(-op);
1108
+ enqueueChangeTree(this.root, this, 'filteredChanges');
1109
+ }
1110
+ else {
1111
+ this.changes.operations.push(-op);
1112
+ enqueueChangeTree(this.root, this, 'changes');
1113
+ }
1108
1114
  }
1109
1115
  change(index, operation = exports.OPERATION.ADD) {
1110
1116
  const metadata = this.ref.constructor[Symbol.metadata];
@@ -3131,6 +3137,10 @@ function dumpChanges(schema) {
3131
3137
  };
3132
3138
  // for (const refId in $root.changes) {
3133
3139
  $root.changes.forEach(changeTree => {
3140
+ // skip if ChangeTree is undefined
3141
+ if (changeTree === undefined) {
3142
+ return;
3143
+ }
3134
3144
  const changes = changeTree.indexedOperations;
3135
3145
  dump.refs.push(`refId#${changeTree.refId}`);
3136
3146
  for (const index in changes) {