meteor-roles
meteor-roles copied to clipboard
Make auto-subscriptions wait until there is a logged in user
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
I'd say this is a good candidate for the next major version 😎 #295