@@ -499,15 +499,18 @@ export abstract class ExtensionWorkerBase<TTab, TTabIdentifier> {
499499
500500 this . uiCommunicator . registerFunction ( Constants . FunctionKeys . signInUser , ( authType : AuthType ) => {
501501 return this . doSignInAction ( authType ) . then ( ( redirectOccurred ) => {
502- if ( redirectOccurred ) {
503- return this . auth . updateUserInfoData ( this . clientInfo . get ( ) . clipperId , UpdateReason . SignInAttempt ) . then ( ( updatedUser : UserInfo ) => {
504- return Promise . resolve ( updatedUser ) ;
505- } ) ;
506- } else {
507- let updatedUser : UserInfo = { updateReason : UpdateReason . SignInCancel } ;
508- this . auth . user . set ( updatedUser ) ;
502+ // Recently, a change in sign-in flow broke our redirect detection, so now we give the benefit of the doubt
503+ // and always attempt to update userInfo regardless
504+ return this . auth . updateUserInfoData ( this . clientInfo . get ( ) . clipperId , UpdateReason . SignInAttempt ) . then ( ( updatedUser : UserInfo ) => {
505+ // While redirect detection is somewhat unreliable, it's still sometimes correct. So we try and
506+ // detect this case only after we try get the latest userInfo
507+ if ( ( ! updatedUser || ! updatedUser . user ) && ! redirectOccurred ) {
508+ let userInfoToSet : UserInfo = { updateReason : UpdateReason . SignInCancel } ;
509+ this . auth . user . set ( userInfoToSet ) ;
510+ return Promise . resolve ( userInfoToSet ) ;
511+ }
509512 return Promise . resolve ( updatedUser ) ;
510- }
513+ } ) ;
511514 } ) . catch ( ( errorObject ) => {
512515 // Set the user info object to undefined as a result of an attempted sign in
513516 this . auth . user . set ( { updateReason : UpdateReason . SignInAttempt } ) ;
0 commit comments