mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-22 21:21:35 +01:00
PS-1161 Added isLoading bool to verify if load() is still running. Keeping Loaded for the ngIf verification (#3198)
This commit is contained in:
parent
83c0456340
commit
1e1a0b1481
@ -38,6 +38,7 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
|
||||
inSidebar = false;
|
||||
searchTypeSearch = false;
|
||||
loaded = false;
|
||||
isLoading = false;
|
||||
showOrganizations = false;
|
||||
|
||||
private totpCode: string;
|
||||
@ -71,7 +72,7 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
|
||||
this.ngZone.run(async () => {
|
||||
switch (message.command) {
|
||||
case "syncCompleted":
|
||||
if (this.loaded) {
|
||||
if (this.isLoading) {
|
||||
window.setTimeout(() => {
|
||||
this.load();
|
||||
}, 500);
|
||||
@ -98,7 +99,7 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
|
||||
await this.load();
|
||||
} else {
|
||||
this.loadedTimeout = window.setTimeout(async () => {
|
||||
if (!this.loaded) {
|
||||
if (!this.isLoading) {
|
||||
await this.load();
|
||||
}
|
||||
}, 5000);
|
||||
@ -197,13 +198,13 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
private async load() {
|
||||
this.loaded = false;
|
||||
this.isLoading = false;
|
||||
this.tab = await BrowserApi.getTabFromCurrentWindow();
|
||||
if (this.tab != null) {
|
||||
this.url = this.tab.url;
|
||||
} else {
|
||||
this.loginCiphers = [];
|
||||
this.loaded = true;
|
||||
this.isLoading = this.loaded = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -256,6 +257,6 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
|
||||
this.loginCiphers = this.loginCiphers.sort((a, b) =>
|
||||
this.cipherService.sortCiphersByLastUsedThenName(a, b)
|
||||
);
|
||||
this.loaded = true;
|
||||
this.isLoading = this.loaded = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user