{"action":"opened","issue":{"url":"https://api.github.com/repos/PolymerElements/paper-scroll-header-panel/issues/80","labels_url":"https://api.github.com/repos/PolymerElements/paper-scroll-header-panel/issues/80/labels{/name}","comments_url":"https://api.github.com/repos/PolymerElements/paper-scroll-header-panel/issues/80/comments","events_url":"https://api.github.com/repos/PolymerElements/paper-scroll-header-panel/issues/80/events","html_url":"https://github.com/PolymerElements/paper-scroll-header-panel/issues/80","id":123517649,"number":80,"title":"Loading the element async produces undefined errors","user":{"login":"robdodson","id":1066253,"avatar_url":"https://avatars.githubusercontent.com/u/1066253?v=3","gravatar_id":"","url":"https://api.github.com/users/robdodson","html_url":"https://github.com/robdodson","followers_url":"https://api.github.com/users/robdodson/followers","following_url":"https://api.github.com/users/robdodson/following{/other_user}","gists_url":"https://api.github.com/users/robdodson/gists{/gist_id}","starred_url":"https://api.github.com/users/robdodson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robdodson/subscriptions","organizations_url":"https://api.github.com/users/robdodson/orgs","repos_url":"https://api.github.com/users/robdodson/repos","events_url":"https://api.github.com/users/robdodson/events{/privacy}","received_events_url":"https://api.github.com/users/robdodson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-22T16:54:38Z","updated_at":"2015-12-22T16:54:38Z","closed_at":null,"body":"I'm not sure the root cause of this issue but here's what I've been able to dig up.\r\n\r\nWhen I load the element async and it has a condenses attribute, the `condensesChanged` observer runs immediately, causing `_updateScrollState` to run. In this function, the `ctx` object is undefined, so checks [like this](https://github.com/PolymerElements/paper-scroll-header-panel/blob/master/paper-scroll-header-panel.html#L560) fail and cause an error. It seems like the `Polymer.PaperScrollHeaderPanel` property has not had a chance to be created when that observer fires. Using `this.async` inside of `_updateScrollState` seems to fix the issue."}}