ensure full sync happens on all clients before navigation

This commit is contained in:
rr-bw 2024-09-13 10:54:13 -07:00
parent de4b1778c1
commit 4012a6c594
No known key found for this signature in database
GPG Key ID: 3FA13C3ADEE51D5D
1 changed files with 2 additions and 3 deletions

View File

@ -224,8 +224,6 @@ export class LoginComponentV2 implements OnInit, OnDestroy {
* @returns A simple `return` statement for each conditional check. * @returns A simple `return` statement for each conditional check.
* If you update this method, do not forget to add a `return` * If you update this method, do not forget to add a `return`
* to each if-condition block where necessary to stop code execution. * to each if-condition block where necessary to stop code execution.
*
* TODO-rr-bw: is using returns a good approach, or should we stick with is/else if/else?
*/ */
private async handleAuthResult(authResult: AuthResult): Promise<void> { private async handleAuthResult(authResult: AuthResult): Promise<void> {
if (this.handleCaptchaRequired(authResult)) { if (this.handleCaptchaRequired(authResult)) {
@ -254,6 +252,8 @@ export class LoginComponentV2 implements OnInit, OnDestroy {
return; return;
} }
await this.syncService.fullSync(true);
if (authResult.forcePasswordReset != ForceSetPasswordReason.None) { if (authResult.forcePasswordReset != ForceSetPasswordReason.None) {
this.loginEmailService.clearValues(); this.loginEmailService.clearValues();
await this.router.navigate(["update-temp-password"]); await this.router.navigate(["update-temp-password"]);
@ -268,7 +268,6 @@ export class LoginComponentV2 implements OnInit, OnDestroy {
// ...on Browser/Desktop // ...on Browser/Desktop
} else { } else {
await this.syncService.fullSync(true); // TODO-rr-bw: browser used `await`, desktop used `return`. Why? Does it matter?
this.loginEmailService.clearValues(); this.loginEmailService.clearValues();
if (this.clientType === ClientType.Browser) { if (this.clientType === ClientType.Browser) {