Let's say I have a computed property that depends on other properties. How can I find out which change on dependency property triggers re-compute on my property. Other than that, is there any way to debug computed chaining?
3 Answers
If your computed properties are in a component, you can try hooking into the didUpdateAttrs hook. didUpdateAttrs fire when values which were passed into the component update. Within the didUpdateAttrs you can check to see what attrs were changed by comparing the old/new values.
didUpdateAttrs: function(attrs) {
// attrs should have access to the old/new values
}
https://guides.emberjs.com/v2.6.0/components/the-component-lifecycle/
didUpdateAttrs runs when the attributes of a component have changed, but not when the component is re-rendered, via component.rerender, component.set, or changes in models or services used by the template.
A didUpdateAttrs is called prior to rerender, you can use this hook to execute code when specific attributes are changed. This hook can be an effective alternative to an observer, as it will run prior to a re-render, but after an attribute has changed.
An example of this scenario in action is a profile editor component. As you are editing one user, and the user attribute is changed, you can use didUpdateAttrs to clear any error state that was built up from editing the previous user.
Maybe LOG_BINDINGS can show you what you need.
https://guides.emberjs.com/v2.14.0/configuring-ember/debugging/#toc_log-object-bindings
What I would do is set breakpoints in the computeds that are being depended on.