@xh/hoist 79.0.0-SNAPSHOT.1765213979166 → 79.0.0-SNAPSHOT.1765576094437

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.
@@ -139,7 +139,7 @@ export declare abstract class HoistBase {
139
139
  /** @returns true if this instance has been destroyed. */
140
140
  get isDestroyed(): boolean;
141
141
  /**
142
- * Clean up resources associated with this object
142
+ * Clean up resources associated with this object.
143
143
  */
144
144
  destroy(): void;
145
145
  }
package/core/HoistBase.ts CHANGED
@@ -287,9 +287,15 @@ export abstract class HoistBase {
287
287
  }
288
288
 
289
289
  /**
290
- * Clean up resources associated with this object
290
+ * Clean up resources associated with this object.
291
291
  */
292
292
  destroy() {
293
+ // If a model is being destroyed or has already been destroyed, no need to destroy it again.
294
+ // Prevents stack overflow in case this model gets a managed reference chain back to itself.
295
+ if (this.isDestroyed) {
296
+ this.logWarn('Destruction skipped - this model is already destroyed.');
297
+ return;
298
+ }
293
299
  this._destroyed = true;
294
300
  this.disposers.forEach(f => f());
295
301
  this.managedInstances.forEach(i => XH.safeDestroy(i));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "79.0.0-SNAPSHOT.1765213979166",
3
+ "version": "79.0.0-SNAPSHOT.1765576094437",
4
4
  "description": "Hoist add-on for building and deploying React Applications.",
5
5
  "repository": "github:xh/hoist-react",
6
6
  "homepage": "https://xh.io",