{"action":"created","issue":{"url":"https://api.github.com/repos/PolymerElements/iron-list/issues/212","repository_url":"https://api.github.com/repos/PolymerElements/iron-list","labels_url":"https://api.github.com/repos/PolymerElements/iron-list/issues/212/labels{/name}","comments_url":"https://api.github.com/repos/PolymerElements/iron-list/issues/212/comments","events_url":"https://api.github.com/repos/PolymerElements/iron-list/issues/212/events","html_url":"https://github.com/PolymerElements/iron-list/issues/212","id":138965168,"number":212,"title":"Computed bindings persist when no item in list","user":{"login":"alexdeefuse","id":607451,"avatar_url":"https://avatars.githubusercontent.com/u/607451?v=3","gravatar_id":"","url":"https://api.github.com/users/alexdeefuse","html_url":"https://github.com/alexdeefuse","followers_url":"https://api.github.com/users/alexdeefuse/followers","following_url":"https://api.github.com/users/alexdeefuse/following{/other_user}","gists_url":"https://api.github.com/users/alexdeefuse/gists{/gist_id}","starred_url":"https://api.github.com/users/alexdeefuse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexdeefuse/subscriptions","organizations_url":"https://api.github.com/users/alexdeefuse/orgs","repos_url":"https://api.github.com/users/alexdeefuse/repos","events_url":"https://api.github.com/users/alexdeefuse/events{/privacy}","received_events_url":"https://api.github.com/users/alexdeefuse/received_events","type":"User","site_admin":false},"labels":[{"id":316618070,"url":"https://api.github.com/repos/PolymerElements/iron-list/labels/p1%20-%20backlog","name":"p1 - backlog","color":"d1c753","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-03-07T12:17:00Z","updated_at":"2016-11-10T12:06:15Z","closed_at":null,"body":"Hi,\n\nI've noticed this issue while having a property that auto-updates at regular intervals (lets say this is a property that counts something - like a ticker). You then have an iron-list where each item gets passed to a computed binding along with the above mentioned auto-updating property. When you try to clean the list up, by setting the \"items\" property to an empty array, the previous bindings still get computed.\n\nHere is some code that illustrates the problem:\n\niron-list-binding-issue.html\n\n```\n<link rel=\"import\" href=\"../polymer/polymer.html\">\n\n<!-- Iron elements -->\n<link rel=\"import\" href=\"../iron-list/iron-list.html\">\n\n<dom-module id=\"iron-list-binding-issue\">\n\n    <template>\n        <div class=\"layout vertical\">\n            <a href=\"#\" on-tap=\"_cleanList\">Clean</a>\n            <iron-list items=\"[[collection]]\" as=\"model\" class=\"flex\">\n                <template>\n                    <div>[[model.title]] - [[_computeProgress(ticker, model)]]</div>\n                </template>\n            </iron-list>\n        </div>\n    </template>\n\n    <script>\n\n        Polymer({\n\n            is: \"iron-list-binding-issue\",\n\n            properties: {\n                ticker: {\n                    type: Number,\n                    notify: true,\n                    value: 0,\n\n                },\n                collection: {\n                    type: Array,\n                    notify: true,\n                }\n            },\n\n            _interval: null,\n\n            attached: function() {\n                var collection = [];\n                for (var i = 0; i < 10; i++) {\n                    collection.push({\n                        title:      \"model #\" + i,\n                        difficulty: Math.random(),\n                    });\n                }\n                this.set(\"collection\", collection);\n                this._interval = window.setInterval(function() {\n                    var val = this.get(\"ticker\");\n                    val += 1;\n                    this.set(\"ticker\", val);\n                }.bind(this), 1000);\n            },\n\n            detached: function() {\n                window.clearInterval(this._interval);\n            },\n\n            _computeProgress: function(ticker, model) {\n                console.log(\"_computeProgress\");\n                console.log(ticker);\n                console.log(model);\n\n                return ticker / model.difficulty;\n            },\n\n            _cleanList: function(e) {\n                e.preventDefault();\n                e.stopPropagation();\n\n                this.set(\"collection\", []);\n            },\n\n        });\n\n    </script>\n\n</dom-module>\n```\n\ndemo.html\n\n```\n<!doctype html>\n<html>\n    <head>\n        <meta charset=\"utf-8\">\n        <meta name=\"viewport\" content=\"width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes\">\n        <title>seed-element Demo</title>\n        <script src=\"../webcomponentsjs/webcomponents-lite.min.js\"></script>\n        <link rel=\"import\" href=\"iron-list-binding-issue.html\">\n    </head>\n    <body unresolved>\n        <iron-list-binding-issue></iron-list-binding-issue>\n    </body>\n</html>\n\n```\n\nWith the code above, initially you see the list getting updated once a second.\nWhen you check out the console log, you'll see some output from the \"_computeProgress\" method.\nIf you then click the \"Clean\" button, the list gets cleaned up, but in the console output, the calls the \"_computeProgress\" still get shown once per second.\n\nI've also tried the above code with template dom-repeat and it works correctly.\n\nBest,\nAlex\n"},"comment":{"url":"https://api.github.com/repos/PolymerElements/iron-list/issues/comments/259674014","html_url":"https://github.com/PolymerElements/iron-list/issues/212#issuecomment-259674014","issue_url":"https://api.github.com/repos/PolymerElements/iron-list/issues/212","id":259674014,"user":{"login":"sasivarnan","id":5305600,"avatar_url":"https://avatars.githubusercontent.com/u/5305600?v=3","gravatar_id":"","url":"https://api.github.com/users/sasivarnan","html_url":"https://github.com/sasivarnan","followers_url":"https://api.github.com/users/sasivarnan/followers","following_url":"https://api.github.com/users/sasivarnan/following{/other_user}","gists_url":"https://api.github.com/users/sasivarnan/gists{/gist_id}","starred_url":"https://api.github.com/users/sasivarnan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sasivarnan/subscriptions","organizations_url":"https://api.github.com/users/sasivarnan/orgs","repos_url":"https://api.github.com/users/sasivarnan/repos","events_url":"https://api.github.com/users/sasivarnan/events{/privacy}","received_events_url":"https://api.github.com/users/sasivarnan/received_events","type":"User","site_admin":false},"created_at":"2016-11-10T12:06:15Z","updated_at":"2016-11-10T12:06:15Z","body":"Any fix or workaround for this issue?"}}
{"actor":{"display_login":"sasivarnan"}}