Please sign in to comment.
Change interface for determining if the user doc is loading to a new …
…reactive function Meteor.userLoading(). The value of Meteor.user() is not defined if userLoading returns true. The Handlebars helper currentUser is "true" if the user is loading, and a new helper currentUserLoading is equivalent to Meteor.userLoading. The current user subscription is now named meteor.currentUser rather than being an unnamed sub. (loginServiceConfiguration is renamed meteor.loginServiceConfiguration to match.) This subscription is sub'd from when you log in and unsub'd from when you log out (or if you log in with different credentials). I was very careful to make sure that in the case of "sub #1, unsub #1, sub #2, sub #1 is ready" we do not declare the user to be ready. I could have instead modified livedata_connection to not call ready callbacks for unsub'd subscriptions (add a "delete self.sub_ready_callbacks[obj._id]" to the self.subs removed function) but this seemed less invasive. The password and email tests use this to take a more rigorous approach to waiting for the data to load, and they change the localStorage keys so that multiple tabs running tests don't interact via localStorage.
- Loading branch information...
Showing with 182 additions and 117 deletions.
- +13 −15 packages/accounts-base/accounts_client.js
- +6 −4 packages/accounts-base/accounts_server.js
- +35 −0 packages/accounts-base/localstorage_token.js
- +56 −28 packages/accounts-password/email_tests.js
- +50 −48 packages/accounts-password/passwords_tests.js
- +22 −22 packages/accounts-ui-unstyled/login_buttons.html