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

Annotated attribute binding issues #1874

Closed
robrez opened this issue Jun 15, 2015 · 2 comments
Closed

Annotated attribute binding issues #1874

robrez opened this issue Jun 15, 2015 · 2 comments

Comments

@robrez
Copy link

robrez commented Jun 15, 2015

I'm having trouble w/ a callback not executing whenever an annotated attribute binding uses a function which takes multiple args and one of them is undefined.

If I limit the number of arguments to 1, everything seems to work as expected.

Here's a plnkr
http://plnkr.co/edit/FlN0SJmmjgyEJRlkRE0w?p=preview

Note: That example uses dom-repeat, but I'm getting the same result when using a standalone object outside of any repeater.

@kevinpschaaf
Copy link
Member

As you noted in #1877 (comment), what you are seeing is a result of Polymer's rule to not call observers/computing functions with undefined dependencies (discussed in docs here), which has both performance and ergonomic benefits, but has this side-effect of slightly unintuitive results when structured data may have optional properties that lead to undefined dependencies.

In this case, I'd recommend using a wildcard argument, which guarantees the function is called for each change to the base object and sub-properties thereof:
http://plnkr.co/edit/EyibXcM5hFYrpEbxZ3Jq?p=preview

We'll consider improvements to this API on #1877, so we'll go ahead and close this issue.

@robrez
Copy link
Author

robrez commented Jun 16, 2015

Thanks for the help

sorvell pushed a commit that referenced this issue Jun 24, 2015
… properties

Fixes #1874, #1761: maintain static declarations within declarations that contain custom properties
Fixes #1927: make custom property parser able to see property endings of ; or \n or end token.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants