Why is Meteor.userId() reactive? Does it have to be?

(cross posted from stack overflow: https://stackoverflow.com/questions/48371932/why-is-meteor-userid-reactive-does-it-have-to-be)

I am new to Meteor, and am trying to wrap my head around some of the concepts.

Some of the Account stuff doesn’t quite make sense to me – like why do I want the user ID of the logged in user to be reactive? It seems like that is not something likely to change too often, and can get annoying when (at least in React) this.currentUser.profile.name is temporarily undefined.

Are there advantages to having the user account reactive? Does it have to be?

you have to check Meteor.loggingIn()

True if a login method (such as Meteor.loginWithPassword, Meteor.loginWithFacebook, or Accounts.createUser) is currently in progress. A reactive data source.

logoutOtherClients: https://docs.meteor.com/api/accounts-multi.html#AccountsClient-logoutOtherClients

I think it must be reactive to do so.

2 Likes