Skip to content

Commit

Permalink
Merge pull request #141 from heyheyhello/computed-less-read-work
Browse files Browse the repository at this point in the history
Do less work when reading a computed()
  • Loading branch information
wesley luyten authored Oct 19, 2020
2 parents ea5eacb + 4b4164b commit 9f7f12f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/sinuous/observable/src/observable.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ function computed(observer, value) {

function data() {
if (update._fresh) {
update._observables.forEach(o => o());
if (tracking) {
// If being read from inside another computed, pass observables to it
update._observables.forEach(o => o());
}
} else {
value = update();
}
Expand Down

0 comments on commit 9f7f12f

Please sign in to comment.