Skip to content

Commit

Permalink
Further fix for #2174: don't re-evaluate on access after we know that…
Browse files Browse the repository at this point in the history
… no change occurred.
  • Loading branch information
mbest committed Mar 6, 2017
1 parent d57baad commit a73cee4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spec/asyncBehaviors.js
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,10 @@ describe('Deferred', function() {
source({ key: 'value' });
jasmine.Clock.tick(1);
expect(countEval).toEqual(1);

// Reading it again shouldn't cause an update
expect(c2()).toEqual(c1());
expect(countEval).toEqual(1);
});

it('Should ignore recursive dirty events', function() {
Expand Down
2 changes: 2 additions & 0 deletions src/subscribables/dependentObservable.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ var computedFn = {
this._evalIfChanged = function () {
if (this[computedState].isStale) {
this.evaluateImmediate();
} else {
this[computedState].isDirty = false;
}
return this[computedState].latestValue;
};
Expand Down

0 comments on commit a73cee4

Please sign in to comment.