You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently functions do not support computedFrom, but accessors do. In the case where a VM is exposing an internally calculated value, there is currently no proper way to ask Aurelia to include the method in a dirty check, or to indicate which dependencies need monitoring for change tracking.
Accessors are methods, so when we have a method such as FullName we can decorate it because FullName takes no parameters and returns data dependent on two internal variables that the view never sees, so we are hiding the implementation.
However, if we decide to have arrays of firstNames and lastNames, fullName requires a parameter, typically $index from a repeater. There is now no way of using a get accessor, so we have to 'bodge' the system and include firstName[$index] and lastName[$index] in a method call to simulate 'computedFrom' and ensure the method is called if either of those instances is updated, but this also exposes the implementation to the view.
My suggestions is that we support @computedFrom(...vars) on methods, as this retains knowledge of the dependencies in the VM.
What happens when a method is method is non-deterministic? We don't have a means of specifying dirty-checking, so perhaps we need to support a parameterless @computedFrom(), or allow @binding on a method.
The text was updated successfully, but these errors were encountered:
Currently functions do not support computedFrom, but accessors do. In the case where a VM is exposing an internally calculated value, there is currently no proper way to ask Aurelia to include the method in a dirty check, or to indicate which dependencies need monitoring for change tracking.
Accessors are methods, so when we have a method such as FullName we can decorate it because FullName takes no parameters and returns data dependent on two internal variables that the view never sees, so we are hiding the implementation.
However, if we decide to have arrays of firstNames and lastNames, fullName requires a parameter, typically
$index
from a repeater. There is now no way of using a get accessor, so we have to 'bodge' the system and include firstName[$index] and lastName[$index] in a method call to simulate 'computedFrom' and ensure the method is called if either of those instances is updated, but this also exposes the implementation to the view.My suggestions is that we support
@computedFrom(...vars)
on methods, as this retains knowledge of the dependencies in the VM.What happens when a method is method is non-deterministic? We don't have a means of specifying dirty-checking, so perhaps we need to support a parameterless
@computedFrom()
, or allow@binding
on a method.The text was updated successfully, but these errors were encountered: