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