{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angularfire2/issues/215","repository_url":"https://api.github.com/repos/angular/angularfire2","labels_url":"https://api.github.com/repos/angular/angularfire2/issues/215/labels{/name}","comments_url":"https://api.github.com/repos/angular/angularfire2/issues/215/comments","events_url":"https://api.github.com/repos/angular/angularfire2/issues/215/events","html_url":"https://github.com/angular/angularfire2/issues/215","id":159107827,"number":215,"title":"Multiple subscriptions causing troubles","user":{"login":"cjblomqvist","id":1033848,"avatar_url":"https://avatars.githubusercontent.com/u/1033848?v=3","gravatar_id":"","url":"https://api.github.com/users/cjblomqvist","html_url":"https://github.com/cjblomqvist","followers_url":"https://api.github.com/users/cjblomqvist/followers","following_url":"https://api.github.com/users/cjblomqvist/following{/other_user}","gists_url":"https://api.github.com/users/cjblomqvist/gists{/gist_id}","starred_url":"https://api.github.com/users/cjblomqvist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjblomqvist/subscriptions","organizations_url":"https://api.github.com/users/cjblomqvist/orgs","repos_url":"https://api.github.com/users/cjblomqvist/repos","events_url":"https://api.github.com/users/cjblomqvist/events{/privacy}","received_events_url":"https://api.github.com/users/cjblomqvist/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-08T08:33:54Z","updated_at":"2016-06-13T14:38:34Z","closed_at":null,"body":"Scenario in Angular:\r\n**Service A:**\r\n```\r\nconstructor() {\r\n  this.list = this.angularfire.list('/myList');\r\n}\r\n```\r\n\r\n**Component A:**\r\n```\r\nonInit() {\r\n  this.list = this.serviceA.list;\r\n}\r\n```\r\n\r\n```\r\n<div *ngFor=\"let item of list | async\">\r\n  <componentB />\r\n</div>\r\n```\r\n\r\n**Component B:**\r\n`<componentC />`\r\n\r\n**Component C:**\r\n```\r\nonInit() {\r\n  this.list = this.serviceA.list;\r\n}\r\n```\r\n\r\n`<div *ngFor=\"let item of list | async\">TEST</div>`\r\n\r\nThen you update one of the items in list (e.g. through Firebase admin web interface). This will cause the following:\r\n1) Component C will be destroyed\r\n2) Which causes the async pipe to unsubscribe to the this.list Observable.\r\n3) Due to https://github.com/angular/angularfire2/blob/master/src/utils/firebase_list_factory.ts#L139 - all listeners/subscriptions are cancelled to the ref. Since we have two listeners/subscriptions (one at Component C which should cancel, and one at Component A which should NOT cancel), this will break the app (more specifically, Component A's subscription will cancel which it shouldn't).\r\n\r\nI'll send a PR ASAP to fix this."},"comment":{"url":"https://api.github.com/repos/angular/angularfire2/issues/comments/225600636","html_url":"https://github.com/angular/angularfire2/issues/215#issuecomment-225600636","issue_url":"https://api.github.com/repos/angular/angularfire2/issues/215","id":225600636,"user":{"login":"cjblomqvist","id":1033848,"avatar_url":"https://avatars.githubusercontent.com/u/1033848?v=3","gravatar_id":"","url":"https://api.github.com/users/cjblomqvist","html_url":"https://github.com/cjblomqvist","followers_url":"https://api.github.com/users/cjblomqvist/followers","following_url":"https://api.github.com/users/cjblomqvist/following{/other_user}","gists_url":"https://api.github.com/users/cjblomqvist/gists{/gist_id}","starred_url":"https://api.github.com/users/cjblomqvist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjblomqvist/subscriptions","organizations_url":"https://api.github.com/users/cjblomqvist/orgs","repos_url":"https://api.github.com/users/cjblomqvist/repos","events_url":"https://api.github.com/users/cjblomqvist/events{/privacy}","received_events_url":"https://api.github.com/users/cjblomqvist/received_events","type":"User","site_admin":false},"created_at":"2016-06-13T14:38:33Z","updated_at":"2016-06-13T14:38:33Z","body":"Hey @davideast \r\n\r\nI don't have much time at the moment for a plnkr - I'll get back to you though ASAP I find the time.\r\n\r\nRegarding the PR. I had to do the fix for a project we're doing (where we encounter the issue), hence the PR part was very small. Also, since this was a pure bug fix which seemed very obvious once you understand the problem, I did not feel the need to check too much before submitting. Anyway, despite this I'm very open for a discussion and I can understand your motive behind it :-)"}}
{"actor":{"display_login":"cjblomqvist"}}