Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subsCache.ready() doesn't always work #72

Open
evolross opened this issue Aug 3, 2022 · 0 comments
Open

subsCache.ready() doesn't always work #72

evolross opened this issue Aug 3, 2022 · 0 comments

Comments

@evolross
Copy link

evolross commented Aug 3, 2022

I started using this package in my production app and I'm noticing the following doesn't always work:

subsCache.ready() - tells you if all subscriptions in the cache are ready

It will regularly not return true. However, I created my own global helper that loops and checks each individual cached subscription using the sub.ready() call and it works great:

Template.registerHelper('cachedTemplateSubscriptionsReady', function() {
  const subscriptions = Template.instance().subscriptions;
  if(subscriptions) {
    for(const subscription of subscriptions) {
      if(!subscription.ready())
        return false;
    }
  }
  return true;
});

I'll try to dig into the code myself but I wanted to report this here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant