Skip to content

Commit

Permalink
LifeCycle) Re-anchor on multiple anchorTo calls
Browse files Browse the repository at this point in the history
  • Loading branch information
brianmhunt committed Nov 6, 2019
1 parent 90f1223 commit e93a234
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/lifecycle/src/LifeCycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit e93a234

Please sign in to comment.