Skip to content

Commit

Permalink
Do less work when reading a computed()
Browse files Browse the repository at this point in the history
  • Loading branch information
nettyso committed Oct 18, 2020
1 parent ea5eacb commit 4b4164b
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 4b4164b

Please sign in to comment.