Skip to content

Commit

Permalink
Added comment to help keep a record of why inner evaluation is skipped
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Mar 20, 2012
1 parent c0a3200 commit e89e12a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/subscribables/dependentObservable.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@ ko.dependentObservable = function (evaluatorFunctionOrOptions, evaluatorFunction
}

function evaluateImmediate() {
if (_isBeingEvaluated)
if (_isBeingEvaluated) {
// If the evaluation of a ko.computed causes side effects, it's possible that it will trigger its own re-evaluation.
// This is not desirable (it's hard for a developer to realise a chain of dependencies might cause this, and they almost
// certainly didn't intend infinite re-evaluations). So, for predictability, we simply prevent ko.computeds from causing
// their own re-evaluation. Further discussion at https://github.com/SteveSanderson/knockout/pull/387
return;
}

// Don't dispose on first evaluation, because the "disposeWhen" callback might
// e.g., dispose when the associated DOM element isn't in the doc, and it's not
Expand Down

0 comments on commit e89e12a

Please sign in to comment.