Add dataLoading :! handle.ready () ||! Meteor.user () in createContainer.
export default BaseLayoutContainer = createContainer(() => { var handle = Meteor.subscribe("user.classrooms"); return { currentUser: Meteor.user(), dataLoading: !handle.ready() || !Meteor.user(), classrooms: Classrooms.find({}).fetch(), }; }, BaseLayout);
Meteor.user() will be undefined inside the component before loading, so be sure to dataLoading ? "" : Meteor.user() it from being called by adding a condition like dataLoading ? "" : Meteor.user() dataLoading ? "" : Meteor.user() .
You can also check if the user is logged in !!Meteor.user() . Usually Meteor.userId() loads faster, but if you need to access user data, such as email, you need to call Meteor.user() , in which case you do not need to call both.
source share