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

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

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

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

dylanrtt opened this issue Dec 3, 2015 · 3 comments
Labels
Milestone

Comments

@dylanrtt
Copy link
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
Copy link
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.

@justinbmeyer justinbmeyer added this to the 2.3.5 milestone Dec 3, 2015
@dylanrtt
Copy link
Contributor Author

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
Copy link

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
Labels
Projects
None yet
Development

No branches or pull requests

3 participants