-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[0.9] Annotated computed properties don't work on autobinding template #1500
Comments
Found this while responding to #1499. |
@arthurevans - is Thank you! |
agh. Sorry, apparently I edited that jsbin after posting. Sigh. The sample I intended to post was here: http://output.jsbin.com/xeweza/2/edit?html,output ... but it gets stranger. The dom-if is failing when I'm in edit more in jsbin, but if I preview the page (remove the edit?... from the URL), it appears to work correctly. |
Good catch, Arthur. Root cause was that The flakiness there was pointing to a race condition re: HTML imports loading vs. elements being parsed in the main document. For example, I couldn't reproduce this locally because apparently the imports were loading fast enough to be parsed & executed before the elements in the main document, but on jsBin with higher latency, the elements were parsed and then upgraded synchronously in import order, causing the Moving the registration of |
271a9e3 should fix the use case highlighted, will keep issue open to consider other possible use cases that could fail before closing. |
I ran across some confusing behavior that may be appropriate to mention here. Are annotated computed properties taking the Example: <link rel="import" href="bower_components/polymer/polymer.html">
<dom-module id="sample-element">
<link rel="stylesheet" type="css" href="sample-element.css">
<template>
<template is="dom-repeat" items="{{data}}" as="i">
<div>
<span>Outside of dom-if:</span>
<span>{{computeFancyName(i)}}</span>
</div>
<template is="dom-if" if="{{showItem(i)}}">
<div>
<span>Computed Inside of dom-if for item's named "A":</span>
<span>{{computeFancyName(i)}}</span>
</div>
<!-- uncomment below to make the below div to see the annotated computed property place the value in the dom -->
<!-- <div>
<span>Not computed Inside of dom-if for item's named "A":</span>
<span>{{i.name}}</span>
</div> -->
</template>
</template>
</template>
</dom-module>
<script>
Polymer({
is:'sample-element',
properties:{
data:{
type: Array,
value:function(){
return [
{
"id":1,
"name":"A",
"data":[
{
"id":1,
"name":"Baby A"
}
]
},
{
"id":2,
"name":"B"
},
{
"id":3,
"name":"C"
}
];
}
}
},
showItem:function(item){
return item.name === "A";
},
computeFancyName:function(item){
return "*"+item.name+"*";
}
});
</script> The annotated computed property function is being executed in the |
@jongeho1 That definitely looks like another corner case. @kevinpschaaf I put this example a jsbin here: http://jsbin.com/qefuqe/1/edit?html,console,output Interesting to note: there's a log message for all combinations: "TypeError: Cannot set property 'display' of undefined It seems to be the presence of the second, non-computed binding (rather than the presence of absence of commented-out blocks, for example) that causes the computed property to display correctly inside the dom-if. |
@arthurevans - thank you! That is definitely what I was trying to articulate in terms of behavior.
|
I am having the same issue with a computed property function never being called inside a dom-repeat using two arguments. <template is="dom-repeat" items="{{tableData}}">
<tr>
<template is="dom-repeat" items="{{tableDataLookupKeys}}" as="column">
<td><span>{{_computeTableColumn(item, column)}}</span></td>
</template>
</tr>
</template> however, only using one argument
will call the function |
Confirmed the issue, we'll get this fixed. |
Fixes issue raised in comment #1500 (comment).
@jongeho1 @mcarey1590 The secondary issue mentioned in #1500 (comment) should now be fixed per #1514. |
@kevinpschaaf @arthurevans TYVM! Will try it out! |
@kevinpschaaf so far so good, thank you |
Solution to general ordering problem is to make |
Part of fix for Polymer/polymer#1500
Wait until imports resolve to stamp. Fixes #1500
Part of fix for Polymer/polymer#1500 Use existing decorate fn. Move children into content unconditionally, so this happens for imperatively-created templates also, to support innerHTML setting before DOMContentLoaded.
Not sure if this a bug or not, but because we rely on A. C. P. to replace expressions, it would be nice to be able to use them on a
dom-bind
template.Currently, it's failing with the error:
Repro:
http://jsbin.com/hijise/1/edit?html,console,output
The text was updated successfully, but these errors were encountered: