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

Mixing .splices and .* in observation does not work #3878

Closed
johannesr89 opened this issue Aug 23, 2016 · 5 comments
Closed

Mixing .splices and .* in observation does not work #3878

johannesr89 opened this issue Aug 23, 2016 · 5 comments
Labels

Comments

@johannesr89
Copy link

https://jsfiddle.net/tqcrqran/70/

Please notice how the first div does not have the class called, but the other two do have it. Also please notice how sthElse is logged twice, but called is never logged.

@arthurevans
Copy link

Reproduced. Using foo.*,bar.* as the observer dependencies works; using foo.splices,bar.* as the argument does not, even though both foo.splices and bar.* are firing individually.

@azakus @kevinpschaaf

@kevinpschaaf
Copy link
Member

kevinpschaaf commented Aug 23, 2016

This is as expected; see docs here: "Multi-property observers are not invoked until all dependent properties are defined (!== undefined)".

Since foo.splice is only defined as a result of a notification from an array mutation to foo via push/pop/splice/shift/unshift, such an observer wouldn't be called simply by setting the array. To catch every change to foo (both initial set and splice/mutations), listen for foo.* as @arthurevans suggested.

@johannesr89
Copy link
Author

Then why is the observer observing just foo.splices called when setting foo?

@arthurevans
Copy link

arthurevans commented Sep 1, 2016

@johannesr89 I wondered the same thing. I feel like there's a bug here somewhere, @kevinpschaaf, because the single-property observer on foo.splices is getting called, and by this logic, it shouldn't be.

@pomber
Copy link
Contributor

pomber commented Oct 2, 2016

Note that this issue is not related to bar wildcard. It also happens with (foo.splices, bar).
It's very confusing that the same path (foo.splices) works in a simple observer but doesn't work in a complex observer.

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

No branches or pull requests

4 participants