{"action":"created","issue":{"url":"https://api.github.com/repos/Urigo/angular-meteor/issues/1220","repository_url":"https://api.github.com/repos/Urigo/angular-meteor","labels_url":"https://api.github.com/repos/Urigo/angular-meteor/issues/1220/labels{/name}","comments_url":"https://api.github.com/repos/Urigo/angular-meteor/issues/1220/comments","events_url":"https://api.github.com/repos/Urigo/angular-meteor/issues/1220/events","html_url":"https://github.com/Urigo/angular-meteor/issues/1220","id":132588911,"number":1220,"title":"subscription stopping sometimes on pages reload","user":{"login":"mattiLeBlanc","id":5285035,"avatar_url":"https://avatars.githubusercontent.com/u/5285035?v=3","gravatar_id":"","url":"https://api.github.com/users/mattiLeBlanc","html_url":"https://github.com/mattiLeBlanc","followers_url":"https://api.github.com/users/mattiLeBlanc/followers","following_url":"https://api.github.com/users/mattiLeBlanc/following{/other_user}","gists_url":"https://api.github.com/users/mattiLeBlanc/gists{/gist_id}","starred_url":"https://api.github.com/users/mattiLeBlanc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattiLeBlanc/subscriptions","organizations_url":"https://api.github.com/users/mattiLeBlanc/orgs","repos_url":"https://api.github.com/users/mattiLeBlanc/repos","events_url":"https://api.github.com/users/mattiLeBlanc/events{/privacy}","received_events_url":"https://api.github.com/users/mattiLeBlanc/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Urigo/angular-meteor/labels/More%20info%20needed","name":"More info needed","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/Urigo/angular-meteor/milestones/7","html_url":"https://github.com/Urigo/angular-meteor/milestones/1.3.6-beta.1","labels_url":"https://api.github.com/repos/Urigo/angular-meteor/milestones/7/labels","id":1555730,"number":7,"title":"1.3.6-beta.1","description":"Cleanups and documentation for 1.3.\r\n\r\nWork is being done in https://github.com/ozsay/angular-meteor/tree/1.3.6\r\n\r\nIncludes @DAB0mB 's refactoring without changing APIs.\r\n- Current refactoring - https://github.com/DAB0mB/angular-meteor/tree/1.4.x\r\n- Current refactoring - https://github.com/urigo/angular-meteor/tree/v1.4.x\r\n\r\n* Branch 1.3.6 from master\r\n* Manually merge compatible branch into 1.3.6 (https://github.com/DAB0mB/angular-meteor/tree/compatible/v1.4.x)\r\n* Replaces reactive-context and reactive-scope to the new changes\r\n* Update that branch so that it will include all the changes from from https://github.com/urigo/angular-meteor/tree/v1.4.x like getCollectionReactively and maybe more?\r\n* Make sure to keep angular-meteor 1.2 legacy code\r\n* Include all recent changes in master\r\n* Run angular-meteor-socially on 1.3.6 and everything works perfectly\r\n* Check all existing issues and see that they are answered\r\n* Release beta to let people test it\r\n","creator":{"login":"Urigo","id":1297448,"avatar_url":"https://avatars.githubusercontent.com/u/1297448?v=3","gravatar_id":"","url":"https://api.github.com/users/Urigo","html_url":"https://github.com/Urigo","followers_url":"https://api.github.com/users/Urigo/followers","following_url":"https://api.github.com/users/Urigo/following{/other_user}","gists_url":"https://api.github.com/users/Urigo/gists{/gist_id}","starred_url":"https://api.github.com/users/Urigo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Urigo/subscriptions","organizations_url":"https://api.github.com/users/Urigo/orgs","repos_url":"https://api.github.com/users/Urigo/repos","events_url":"https://api.github.com/users/Urigo/events{/privacy}","received_events_url":"https://api.github.com/users/Urigo/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":12,"state":"open","created_at":"2016-02-01T14:25:22Z","updated_at":"2016-02-13T07:02:47Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2016-02-10T01:58:21Z","updated_at":"2016-02-14T01:12:31Z","closed_at":null,"body":"Hi,\r\n\r\nI am having an issue where my subscription sometimes stops after a page reload during development in Meteor.\r\nSometimes it does load, sometimes it doesn't.\r\nI use Typescript.\r\n\r\nMy subscription setup is standard as in docs:\r\n```\r\nprivate invoiceFilter = {\r\n\r\n    'AmountDue': { $gt: 0 }\r\n  };\r\n\r\nconstructor( private $log: angular.ILogService, private $state: angular.ui.IStateService, private authService: any, private $modal: any, private $scope: any, $reactive: any ) {\r\n\r\n    $reactive( this ).attach( $scope );\r\n\r\n    this.subscribe( 'invoices', () => [ this.invoiceFilter ],  {\r\n\r\n      onReady: function () {\r\n        console.log(\"onReady And the Items actually Arrive\", arguments);\r\n        // subscriptionHandle.stop();  // Stopping the subscription, will cause onStop to fire\r\n      },\r\n      onStop: function (error) {\r\n        if (error) {\r\n          console.log('An error happened - ', error);\r\n        } else {\r\n          console.log('The subscription stopped');\r\n        }\r\n      }\r\n    });\r\n    this.helpers( {\r\n      invoices: () => Invoices.find( {}, { limit :10} )\r\n    } );\r\n  }\r\n```\r\n\r\nIn my server console I see the subscription always loaded with a userId\r\n```\r\n=> Client modified -- refreshing\r\nI20160210-12:51:11.059(11)? invoice subscription loaded { AmountDue: { '$gt': 0 }, userId: 'Lkqe4W5LR9TLQfegr' }\r\nI20160210-12:51:15.001(11)? invoice subscription loaded { AmountDue: { '$gt': 0 }, userId: 'Lkqe4W5LR9TLQfegr' }\r\nI20160210-12:51:54.171(11)? invoice subscription loaded { AmountDue: { '$gt': 0 }, userId: 'Lkqe4W5LR9TLQfegr' }\r\n```\r\n\r\nMy subscription looks like\r\n```\r\n// IMPORTANT NOT TO USE FAT ARROW DUE TO LOSS OF THIS SCOPE. this.userId will become undefined\r\n//\r\nMeteor.publish( 'invoices', function ( filter: any ) {\r\n\r\n  filter         = filter || {};\r\n  filter.userId  = this.userId;\r\n\r\n  console.log( 'invoice subscription loaded', filter );\r\n\r\n  return Invoices.find( filter, {\r\n    fields: {\r\n      'Total':          1\r\n    , 'DueDate':        1\r\n    , 'Date':           1\r\n    , 'InvoiceNumber':  1\r\n    , 'LineItems.Description' : 1\r\n    , 'Contact.Name':   1\r\n    }\r\n  } );\r\n} );\r\n```\r\n\r\nI am not seeing any error. I my Chrome console I just see `The subscription stopped`. When I change state and go back to overview than most of the time the subscription doesn't stop.\r\nWhen it did stop and I just refresh browser it stops immediately.\r\n\r\nUsing Angular Meteor 1.3.5.\r\n\r\nIs this issue on my side or so timing issue with the subscription and the user Id?"},"comment":{"url":"https://api.github.com/repos/Urigo/angular-meteor/issues/comments/183783693","html_url":"https://github.com/Urigo/angular-meteor/issues/1220#issuecomment-183783693","issue_url":"https://api.github.com/repos/Urigo/angular-meteor/issues/1220","id":183783693,"user":{"login":"mattiLeBlanc","id":5285035,"avatar_url":"https://avatars.githubusercontent.com/u/5285035?v=3","gravatar_id":"","url":"https://api.github.com/users/mattiLeBlanc","html_url":"https://github.com/mattiLeBlanc","followers_url":"https://api.github.com/users/mattiLeBlanc/followers","following_url":"https://api.github.com/users/mattiLeBlanc/following{/other_user}","gists_url":"https://api.github.com/users/mattiLeBlanc/gists{/gist_id}","starred_url":"https://api.github.com/users/mattiLeBlanc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattiLeBlanc/subscriptions","organizations_url":"https://api.github.com/users/mattiLeBlanc/orgs","repos_url":"https://api.github.com/users/mattiLeBlanc/repos","events_url":"https://api.github.com/users/mattiLeBlanc/events{/privacy}","received_events_url":"https://api.github.com/users/mattiLeBlanc/received_events","type":"User","site_admin":false},"created_at":"2016-02-14T01:12:31Z","updated_at":"2016-02-14T01:12:31Z","body":"I can check next week when I am back from my holiday.\nCheers\nOn 13 Feb 2016 8:26 am, \"Uri Goldshtein\" <notifications@github.com> wrote:\n\n> angular@1.3.6-beta.1 was released.\n> @mattiLeBlanc <https://github.com/mattiLeBlanc> Please check if that\n> works for you.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/Urigo/angular-meteor/issues/1220#issuecomment-183540784>\n> .\n>\n"}}