dep.js (value): Force the dep before registering a dependents.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 30 Jun 2018 21:49:23 +0000 (22:49 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 30 Jun 2018 21:49:23 +0000 (22:49 +0100)
Otherwise we'll add the dependent to the list, and then `_propagate'
will clear the list, forgetting about us.

dep.js

diff --git a/dep.js b/dep.js
index d21f94a..ec09e83 100644 (file)
--- a/dep.js
+++ b/dep.js
@@ -395,11 +395,11 @@ Dep.prototype = {
     var val;
 
     if (STATE === 'recomputing') {
+      this._force();
       if (EVALUATING) {
        this._dependents[EVALUATING._seq] = EVALUATING;
        EVALUATING._dependencies[this._seq] = this;
       }
-      this._force();
     }
     val = this._value;
     if (val === BAD) throw BAD;