@colyseus/schema 3.0.17 → 3.0.18

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.
@@ -4068,7 +4068,7 @@ class ReferenceTracker {
4068
4068
  for (const index in metadata) {
4069
4069
  const field = metadata[index].name;
4070
4070
  const childRefId = typeof (ref[field]) === "object" && this.refIds.get(ref[field]);
4071
- if (childRefId) {
4071
+ if (childRefId && !this.deletedRefs.has(childRefId)) {
4072
4072
  this.removeRef(childRefId);
4073
4073
  }
4074
4074
  }
@@ -4076,7 +4076,12 @@ class ReferenceTracker {
4076
4076
  else {
4077
4077
  if (typeof (Object.values(ref[$childType])[0]) === "function") {
4078
4078
  Array.from(ref.values())
4079
- .forEach((child) => this.removeRef(this.refIds.get(child)));
4079
+ .forEach((child) => {
4080
+ const childRefId = this.refIds.get(child);
4081
+ if (!this.deletedRefs.has(childRefId)) {
4082
+ this.removeRef(childRefId);
4083
+ }
4084
+ });
4080
4085
  }
4081
4086
  }
4082
4087
  this.refs.delete(refId); // remove ref