Binding an undefined property to a component runs the setter #2117

Closed
dylanrtt opened this Issue Dec 3, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@dylanrtt
Contributor

dylanrtt commented Dec 3, 2015

In the following example, if the parent bar is undefined, the foo setter will run anyway. Maybe I'm wrong, but I don't think that's the right behavior. This is new in 2.3.3 and was not happening previously. It affects both 1-way and 2-way bindings using the new syntax (old binding syntax unaffected).

<foo-bar {foo}="bar"></foo-bar>

http://jsbin.com/guweguqovi/edit?html,js,console

I just noticed that if the parent property is defined, the setter is run twice, which is strange for a 1-way binding, right? That is also new to 2.3.3.

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Dec 3, 2015

Contributor

I think setting the child to undefined is probably the right behavior. If the child had a value, the one-way binding should probably overwrite it to undefined.

The double set is certainly a bug. Will fix tomorrow.

Contributor

justinbmeyer commented Dec 3, 2015

I think setting the child to undefined is probably the right behavior. If the child had a value, the one-way binding should probably overwrite it to undefined.

The double set is certainly a bug. Will fix tomorrow.

@justinbmeyer justinbmeyer added the bug label Dec 3, 2015

@justinbmeyer justinbmeyer added this to the 2.3.5 milestone Dec 3, 2015

@dylanrtt

This comment has been minimized.

Show comment
Hide comment
@dylanrtt

dylanrtt Dec 3, 2015

Contributor

This popped up as an issue in places where an asynchronous virtual property's value is passed to a component where undefined is never expected, but perhaps it is the right behavior. I'll update my setters regardless of what you decide.

Contributor

dylanrtt commented Dec 3, 2015

This popped up as an issue in places where an asynchronous virtual property's value is passed to a component where undefined is never expected, but perhaps it is the right behavior. I'll update my setters regardless of what you decide.

@pYr0x

This comment has been minimized.

Show comment
Hide comment
@pYr0x

pYr0x Dec 3, 2015

@dylanrtt respect, nice work, you have found most of the bugs ;)

pYr0x commented Dec 3, 2015

@dylanrtt respect, nice work, you have found most of the bugs ;)

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