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

<template if> evaluating all expressions twice #433

Closed
esprehn opened this issue Mar 1, 2014 · 2 comments
Closed

<template if> evaluating all expressions twice #433

esprehn opened this issue Mar 1, 2014 · 2 comments

Comments

@esprehn
Copy link

esprehn commented Mar 1, 2014

<polymer-element name="ex-ample">
    <template>
        <template if="{{ item }}">
            {{ item.created | formatDate }}
        </template>
    </template>
    <script>
        Polymer("ex-ample", {
            item: {created: new Date()},
            formatDate: function(date) {
                console.log(date);
                return "";
            },
        });
    </script>
</polymer-element>
<ex-ample></ex-ample>

if you open the console you'll see the date value logged twice. If you put a custom element inside the <template if> with a console.log in the created callback it only prints once so it's not stamping twice, but it does evaluate all the binding values twice even though nothing has changed.

This is with Object.observe and Experimental Web Platform Features turned on.

@sjmiles
Copy link
Contributor

sjmiles commented Mar 1, 2014

@rafaelw

@rafaelw
Copy link
Contributor

rafaelw commented Mar 9, 2014

This was a polymer-expressions bug. Fixed here: googlearchive/polymer-expressions@e0a6646

@rafaelw rafaelw closed this as completed Mar 9, 2014
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

3 participants