Don't display logging-in animation in onReconnect.

This commit is contained in:
David Glasser
2012-11-19 20:33:08 -08:00
parent 7cc88dc75e
commit 426a72fe24

View File

@@ -59,7 +59,8 @@
Accounts.callLoginMethod = function (options) { Accounts.callLoginMethod = function (options) {
options = _.extend({ options = _.extend({
methodName: 'login', methodName: 'login',
methodArguments: [] methodArguments: [],
_suppressLoggingIn: false
}, options); }, options);
// Set defaults for callback arguments to no-op functions; make sure we // Set defaults for callback arguments to no-op functions; make sure we
// override falsey values too. // override falsey values too.
@@ -92,6 +93,10 @@
reconnected = true; reconnected = true;
Accounts.callLoginMethod({ Accounts.callLoginMethod({
methodArguments: [{resume: result.token}], methodArguments: [{resume: result.token}],
// Reconnect quiescence ensures that the user doesn't see an
// intermediate state before the login method finishes. So we don't
// need to show a logging-in animation.
_suppressLoggingIn: true,
userCallback: function (error) { userCallback: function (error) {
if (error) { if (error) {
Accounts._makeClientLoggedOut(); Accounts._makeClientLoggedOut();
@@ -114,7 +119,8 @@
if (reconnected) if (reconnected)
return; return;
Accounts._setLoggingIn(false); if (!options._suppressLoggingIn)
Accounts._setLoggingIn(false);
if (error || !result) { if (error || !result) {
error = error || new Error( error = error || new Error(
"No result from call to " + options.methodName); "No result from call to " + options.methodName);
@@ -133,7 +139,8 @@
options.userCallback(); options.userCallback();
}; };
Accounts._setLoggingIn(true); if (!options._suppressLoggingIn)
Accounts._setLoggingIn(true);
Meteor.apply( Meteor.apply(
options.methodName, options.methodName,
options.methodArguments, options.methodArguments,