-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Description
Which @angular/* package(s) are relevant/related to the feature request?
core
Description
Hi
Right now, computed re evaluates every time any of the underlying signal's properties change, regardless of whether the computed is accessing this property or not, which leads to unnecessary computations and possible re renders.
Coming from MobX, which also has computed but works as described above, makes computed very efficient and performant.
I hope you can consider this improvement, since especially in expensive computations will have a major impact in performance.
Below is an example of the scenario I described
https://stackblitz.com/edit/stackblitz-starters-pjevlf?file=src%2Fapp%2Fservice.ts
Every time the signal's name updates, the computed that calculates the total price re evaluates, although the computed only reads the price property and never accesses the name property.
Regards
Proposed solution
computed should re evaluate only when the signal properties it accesses, change.
Alternatives considered
None