Open natalie-natsu opened 8 years ago
I would think that this would work, as long as the template is the only template waiting for a subscription. If you have multiple subscriptions on the page, (which could occur with paginated tables), then you will have to wait for all of them to complete. For example:
var completedSubscriptions = {};
markSubscriptionAsReady = function(templateName){
completedSubscriptions[templateName] = true;
if(_.keys(completedSubscriptions).length === 2){
Meteor.isReadyForSpiderable = true;
}
}
Template.list.onCreated(function () {
this.autorun(() => {
if (this.subscriptionReady()) {
markSubscriptionAsReady("list");
}
});
});
Template.someOtherTemplate.onCreated(function () {
this.autorun(() => {
if (this.subscriptionReady()) {
markSubscriptionAsReady("someOtherTemplate");
}
});
});
Hello @WaSa42 ,
Have you solved it on your end?
Sadly no, it's been a while but I remember trying the solution that jazeee wrote behind and that it was not concluent. Maybe I did something wrong, did you try jazeee's solution too ?
Solved it by using this package for managing all subscriptions: https://github.com/ccorcos/meteor-subs-cache. Then you can wait for subsCache.allReady()
to set Meteor.isReadyForSpiderable = true
. (Note that this bug seems to be still alive https://github.com/ccorcos/meteor-subs-cache/issues/20). Pretty straightforward, and you get all the great features from SubsCache for free ;D
Hello everyone,
Shall we close this thread? //cc @mksh-su
Hi,
I'm having some trouble setting
Meteor.isReadyForSpiderable = true;
when subscriptions are defined in the template and not the route.Paginated tables are good example of this case.
I tried to wait
Template.subscriptionReady()
in theTemplate.templateName.onCreated
callback, but there's nothing concluent.Do you have any idea ?
Here's my code:
Thanks,