From e93a2346ff50bc4f3a190cdfcb26175c350b9607 Mon Sep 17 00:00:00 2001 From: Brian M Hunt Date: Wed, 6 Nov 2019 09:22:48 -0500 Subject: [PATCH] LifeCycle) Re-anchor on multiple `anchorTo` calls --- packages/lifecycle/src/LifeCycle.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/lifecycle/src/LifeCycle.js b/packages/lifecycle/src/LifeCycle.js index e53ca216..20a3b018 100644 --- a/packages/lifecycle/src/LifeCycle.js +++ b/packages/lifecycle/src/LifeCycle.js @@ -75,7 +75,8 @@ export default class LifeCycle { anchorTo (nodeOrLifeCycle) { if ('addDisposable' in nodeOrLifeCycle) { - nodeOrLifeCycle.addDisposable.push(this) + nodeOrLifeCycle.addDisposable(this) + this[ANCHOR_NODE] = null // re-anchor on `anchorTo` calls } else { this[ANCHOR_NODE] = nodeOrLifeCycle addDisposeCallback(nodeOrLifeCycle, () => this[ANCHOR_NODE] === nodeOrLifeCycle && this.dispose())