@colyseus/schema 3.0.0-alpha.32 → 3.0.0-alpha.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.
@@ -483,13 +483,7 @@ class ChangeTree {
483
483
  //
484
484
  // (the property descriptors should NOT be used at decoding time. only at encoding time.)
485
485
  //
486
- const refCount = this.root?.remove(previousValue[$changes]);
487
- //
488
- // Only remove "root" reference if it's the last reference
489
- //
490
- if (refCount <= 0) {
491
- previousValue[$changes].root = undefined;
492
- }
486
+ this.root?.remove(previousValue[$changes]);
493
487
  }
494
488
  //
495
489
  // FIXME: this is looking a bit ugly (and repeated from `.change()`)
@@ -3469,6 +3463,10 @@ class Root {
3469
3463
  remove(changeTree) {
3470
3464
  const refCount = (this.refCount.get(changeTree)) - 1;
3471
3465
  if (refCount <= 0) {
3466
+ //
3467
+ // Only remove "root" reference if it's the last reference
3468
+ //
3469
+ changeTree.root = undefined;
3472
3470
  this.allChanges.delete(changeTree);
3473
3471
  this.changes.delete(changeTree);
3474
3472
  if (changeTree.isFiltered || changeTree.isPartiallyFiltered) {