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

Make auto-subscriptions wait until there is a logged in user #331

Open
jankapunkt opened this issue Jan 13, 2021 · 3 comments
Open

Make auto-subscriptions wait until there is a logged in user #331

jankapunkt opened this issue Jan 13, 2021 · 3 comments
Milestone

Comments

@jankapunkt
Copy link
Member

jankapunkt commented Jan 13, 2021

This kind of a question / feature request.

Currently the package's client code automatically subscribes to the roles and immediately causes data being loaded.

I would like to defer this step until my users are actually logged in reducing the initial data load when starting the app. I know this is just a tiny performance improvement but many of these small things add up in the end.

Proposed solution:

Tracker.autorun(function () {
  if (!Meteor.userId()) return
  Roles.subscription = Meteor.subscribe('_roles')
})

I assume, that the information about user roles on the client makes no sense until there is not a logged in user (correct me if there is a usecase, that contradicts this assumption). Therefore this should not have any negative impact on current setups.

I could provide a PR for this

@jankapunkt jankapunkt changed the title Make auto-subscriptions optional Make auto-subscriptions wait until there is a logged in user Jan 13, 2021
@SimonSimCity
Copy link
Member

I'd say this is a good candidate for the next major version 😎 #295

@StorytellerCZ StorytellerCZ added this to the Release 4.0 milestone Aug 5, 2021
@drone1
Copy link

drone1 commented Sep 27, 2024

Roles.subscription got deleted? I don't see any info about this in the v4 notes. Actually I don't see any v4 notes :) My code waits for Roles.subscription.ready() – please advise! Thank you.

@drone1
Copy link

drone1 commented Oct 15, 2024

I see this was removed in c46b2e6 and monitoring a subscription is no longer necessary.

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

4 participants