[PM-6948] Fix race condition that breaks autofill within the current tab component (#8393)

This commit is contained in:
Cesar Gonzalez 2024-03-21 13:40:37 -05:00 committed by GitHub
parent b450b31ec4
commit 19c97fb796
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 11 deletions

View File

@ -262,14 +262,6 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
this.hostname = Utils.getHostname(this.url);
this.pageDetails = [];
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
BrowserApi.tabSendMessage(this.tab, {
command: "collectPageDetails",
tab: this.tab,
sender: BroadcasterSubscriptionId,
});
const otherTypes: CipherType[] = [];
const dontShowCards = !(await firstValueFrom(this.vaultSettingsService.showCardsCurrentTab$));
const dontShowIdentities = !(await firstValueFrom(
@ -310,9 +302,18 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
}
});
this.loginCiphers = this.loginCiphers.sort((a, b) =>
this.cipherService.sortCiphersByLastUsedThenName(a, b),
);
if (this.loginCiphers.length) {
void BrowserApi.tabSendMessage(this.tab, {
command: "collectPageDetails",
tab: this.tab,
sender: BroadcasterSubscriptionId,
});
this.loginCiphers = this.loginCiphers.sort((a, b) =>
this.cipherService.sortCiphersByLastUsedThenName(a, b),
);
}
this.isLoading = this.loaded = true;
}