@colyseus/schema 3.0.0-alpha.32 → 3.0.0-alpha.34

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