@colyseus/schema 3.0.24 → 3.0.26

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.
@@ -97,11 +97,18 @@ export class Root {
97
97
 
98
98
  removeChangeFromChangeSet(changeSetName: "allChanges" | "changes" | "filteredChanges" | "allFilteredChanges", changeTree: ChangeTree) {
99
99
  const changeSet = this[changeSetName];
100
- if (spliceOne(changeSet, changeSet.indexOf(changeTree))) {
100
+ const changeSetIndex = changeSet.indexOf(changeTree);
101
+
102
+ if (changeSetIndex !== -1) {
101
103
  changeTree[changeSetName].queueRootIndex = -1;
102
- // changeSet[index] = undefined;
104
+ changeSet[changeSetIndex] = undefined;
103
105
  return true;
104
106
  }
107
+
108
+ // if (spliceOne(changeSet, changeSet.indexOf(changeTree))) {
109
+ // changeTree[changeSetName].queueRootIndex = -1;
110
+ // return true;
111
+ // }
105
112
  }
106
113
 
107
114
  clear() {
@@ -360,11 +360,13 @@ export class ArraySchema<V = any> implements Array<V>, Collection<number, V> {
360
360
  if (this.items.length === 0) { return undefined; }
361
361
 
362
362
  // const index = Number(Object.keys(changeTree.indexes)[0]);
363
- const index = this.tmpItems.findIndex((item, i) => item === this.items[0]);
364
363
  const changeTree = this[$changes];
365
364
 
366
- changeTree.delete(index);
367
- changeTree.shiftAllChangeIndexes(-1, index);
365
+ const index = this.tmpItems.findIndex(item => item === this.items[0]);
366
+ const allChangesIndex = this.items.findIndex(item => item === this.items[0]);
367
+
368
+ changeTree.delete(index, OPERATION.DELETE, allChangesIndex);
369
+ changeTree.shiftAllChangeIndexes(-1, allChangesIndex);
368
370
 
369
371
  // this.deletedIndexes[index] = true;
370
372