Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Derived properties and on change listener sequence #246

Open
dan-iway opened this issue Jul 18, 2016 · 0 comments
Open

Derived properties and on change listener sequence #246

dan-iway opened this issue Jul 18, 2016 · 0 comments

Comments

@dan-iway
Copy link

I have stumbled upon this a few times now, I am not sure if this is a bug or I just fail to understand the concept here:
If there is both a change listener and a derived property depending on the same property and the change listener accesses the derived property it seems that the change listener is executed first, the derived property gets updated after that. I would expect that all derived properties are already updated when the change events are triggered.

See example code on requirebin:
view on requirebin

With this output:

B sees A changed to: 2
Trigger on A thinks B is: 2

B sees A changed to: 2
Trigger on A thinks B is: 2

B sees A changed to: 3
Trigger on A thinks B is: 3

B sees A changed to: 4

While the derived property gets updated for every change, the trigger seems unable to access B after the last change. Also the derived property is calculated 4 times in total, twice for number 2, why?

If line 23 is removed, the derived property is calculated only 3 times as expected. Why does accessing a derived property change how often it is calculated? That should only depend on its deps, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant