dart-archive / observe

Support for marking objects as observable, and getting notifications when those objects are mutated
https://pub.dartlang.org/packages/observe
BSD 3-Clause "New" or "Revised" License
13 stars 6 forks source link

A path observer to an observable object should listen for any changes on that object #12

Open jakemac53 opened 9 years ago

jakemac53 commented 9 years ago

Repro: https://gist.github.com/jakemac53/aa2aceb4be88fdfd9efb

prints:

incrementing bar.foo.foo
Compound observer on `foo.foo` saw a change

when I would expect it to print:

incrementing bar.foo.foo
Compound observer on `foo` saw a change
Compound observer on `foo.foo` saw a change
jakemac53 commented 9 years ago

I think this might actually be as designed, but if that is the case then I think the design is wrong

jakemac53 commented 9 years ago

Ok, so I talked with @sigmundch about this and it is currently working as intended.

We should however provide some sort of interface for overriding this behavior so that if a path ends in an Observable it will also listen for changes on that object. This could probably be done with a named argument.