Observing a property on a containerView dependent on '@each.blah' fails and breaks certain aspects of containerView #2283

Closed
endash opened this Issue Mar 16, 2013 · 2 comments

Comments

Projects
None yet
2 participants
Contributor

endash commented Mar 16, 2013

See the fiddle: http://jsfiddle.net/dvcby/1/

To be clear: the problem arises when you have (1) a computed property that depends on a property on '@each' and (2) an observer or a binding either on that property or another property down the line that ultimately depends on the first property

UPDATE: Simply directly observing @each.blah without any intermediary computed properties has the exact same behaviour.

Not only does the observer never fire, but the length property gets reported as 0 regardless of its true value. Remove the .observes(), and the length property is restored.

Additional chaining of computed properties in place of an observer does NOT have the same effect. A binding DOES have the same effect.

Contributor

endash commented Mar 17, 2013

OK so it turns out that the problem is the length property.

Because init doesn't call arrayContentDidChange, length never gets expired, even though the content (in array terms) is getting set in init, so the length goes from 0 to x without any notifications.

See http://jsfiddle.net/rc9cr/6/ for an updated jsfiddle showing expected behaviour once the arrayContentDidChange call is added.

Owner

wagenet commented Mar 19, 2013

Closing in favor of #2286.

@wagenet wagenet closed this Mar 19, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment