{"action":"created","issue":{"url":"https://api.github.com/repos/taylorhakes/promise-polyfill/issues/11","labels_url":"https://api.github.com/repos/taylorhakes/promise-polyfill/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/taylorhakes/promise-polyfill/issues/11/comments","events_url":"https://api.github.com/repos/taylorhakes/promise-polyfill/issues/11/events","html_url":"https://github.com/taylorhakes/promise-polyfill/issues/11","id":90147951,"number":11,"title":"Different behavior between Chrome/Firefox implementation and polyfill","user":{"login":"mockdeep","id":80543,"avatar_url":"https://avatars.githubusercontent.com/u/80543?v=3","gravatar_id":"","url":"https://api.github.com/users/mockdeep","html_url":"https://github.com/mockdeep","followers_url":"https://api.github.com/users/mockdeep/followers","following_url":"https://api.github.com/users/mockdeep/following{/other_user}","gists_url":"https://api.github.com/users/mockdeep/gists{/gist_id}","starred_url":"https://api.github.com/users/mockdeep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mockdeep/subscriptions","organizations_url":"https://api.github.com/users/mockdeep/orgs","repos_url":"https://api.github.com/users/mockdeep/repos","events_url":"https://api.github.com/users/mockdeep/events{/privacy}","received_events_url":"https://api.github.com/users/mockdeep/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-22T16:35:40Z","updated_at":"2015-06-23T00:33:56Z","closed_at":null,"body":"I'm having a hard time nailing it down, but my code works in both the latest Firefox and Chrome, and when I run the tests in Selenium, but when I require the polyfill for Poltergeist/Phantomjs, I get different behavior. It appears that my callback isn't being called when I nest promises. Pardon the messy code, it's in transition:\r\n\r\n```js\r\nvar TimeframeStore = {\r\n  ...\r\n  getAll: function () {\r\n    return new Promise(function (resolve, reject) {\r\n      TaskStore.getAll().then(function (data) {\r\n        this.updateModels(data);\r\n        request({\r\n          method: 'get',\r\n          url: this.url(),\r\n          success: function (data) {\r\n            medianProductivity = data.meta.medianProductivity;\r\n            resolve(this.getData());\r\n          }.bind(this)\r\n        });\r\n      }.bind(this));\r\n    }.bind(this));\r\n  }\r\n}\r\n```\r\n\r\nand inside my component:\r\n\r\n```js\r\nvar TimeframesIndex = React.createClass({\r\n  ...\r\n  componentDidMount: function () {\r\n    TimeframeStore.getAll().then(function (data) {\r\n      this.updateTimeframes(data);\r\n      TimeframeStore.on('change', this.loadTasks);\r\n    }.bind(this));\r\n  },\r\n\r\n  loadTasks: function () {\r\n    TimeframeStore.getAll().then(this.updateTimeframes);\r\n  },\r\n  ...\r\n}\r\n```\r\n\r\nIt works as expected in `componentDidMount`, but when it gets called a second time in `loadTasks`, even though I can confirm that `resolve` gets called within the nested promise, `updateTimeframes` never gets called."},"comment":{"url":"https://api.github.com/repos/taylorhakes/promise-polyfill/issues/comments/114312365","html_url":"https://github.com/taylorhakes/promise-polyfill/issues/11#issuecomment-114312365","issue_url":"https://api.github.com/repos/taylorhakes/promise-polyfill/issues/11","id":114312365,"user":{"login":"taylorhakes","id":341159,"avatar_url":"https://avatars.githubusercontent.com/u/341159?v=3","gravatar_id":"","url":"https://api.github.com/users/taylorhakes","html_url":"https://github.com/taylorhakes","followers_url":"https://api.github.com/users/taylorhakes/followers","following_url":"https://api.github.com/users/taylorhakes/following{/other_user}","gists_url":"https://api.github.com/users/taylorhakes/gists{/gist_id}","starred_url":"https://api.github.com/users/taylorhakes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taylorhakes/subscriptions","organizations_url":"https://api.github.com/users/taylorhakes/orgs","repos_url":"https://api.github.com/users/taylorhakes/repos","events_url":"https://api.github.com/users/taylorhakes/events{/privacy}","received_events_url":"https://api.github.com/users/taylorhakes/received_events","type":"User","site_admin":false},"created_at":"2015-06-23T00:33:56Z","updated_at":"2015-06-23T00:33:56Z","body":"I haven't seen an issue like this before. I and others are using the library the exact same way in production. Not saying there isn't an issue, but most likely it is something in your model code. Is the code in a public repo? I'll take a look. If not, it would be really helpful if you can reproduce the issue in jsfiddle.\r\n\r\nSince you are only seeing the issue when polyfilling, maybe some code executing before you do \r\n```\r\nif (!window.Promise) {\r\n  window.Promise = require('promise-polyfill');\r\n}\r\n```\r\n? Maybe code is holding on to an undefined reference? Just a guess. I might be way off."}}