Hi guys. I’ve been trying to solve this issue for a while now but cant find any solution to it.
-
When resolving a subscription in a router everything works fine but subscription wont unsubscribe automatically when leaving scope. I also cannot inject designSubsc into constructor to be able to stop it manually designSubsc.stop()
resolve: { designSubsc($q, $stateParams) { var deferred = $q.defer(); var designId = $stateParams.designId; var userCompanyId = Meteor.user().company.companyId; const handle = Meteor.subscribe('designSingle', designId, userCompanyId, { onReady: () => deferred.resolve(handle), onStop: deferred.reject }); return deferred.promise; } }
-
If I resolve in a component
this.subscribe('designSingle', () => { return [ this.getReactively('designId'), this.getReactively('userCompanyId') ] });
everything works as expected until I refresh the browser, then objects returned from this.helpers becomes undefined within a component and I cannot resolve my other queries.
this.helpers({
design() { return Designs.findOne({ styleNumber: this.designId })},
basesize() { return SizeRange.find({ _id: this.design.style.sizerange_id._id }) }
})
basesize would throw an error after browser refresh. Does anyone had similar problem and maybe found a solution?
Thanks!