From e3a1595c2c26f8f7848f4c44e91d65cf2bb6a551 Mon Sep 17 00:00:00 2001 From: Adrian Sanchez Date: Thu, 15 Feb 2018 11:51:44 -0600 Subject: [PATCH] Do not dispatch event on destroyed flows If a tree falls in a forest and no one is around to hear it, does it make a sound? --- fluorine.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fluorine.js b/fluorine.js index 04918fe..f13087d 100644 --- a/fluorine.js +++ b/fluorine.js @@ -258,6 +258,11 @@ Class('FlowNode').includes(NodeSupport)({ fulfill : function (data) { this.data = data; this.isFulfilled = true; + + if (this.parent === null) { + return; + } + this.parent.dispatch(this.name); }, @@ -268,6 +273,11 @@ Class('FlowNode').includes(NodeSupport)({ reject : function (error) { this.error = error; this.isRejected = true; + + if (this.parent === null) { + return; + } + this.parent.dispatch(this.name); this.parent.dispatch('reject', { data : { node : this, error: error }