Trust our own copy of authenticatedAccounts until all accounts are initialized (#8888)
This commit is contained in:
parent
790c9a6141
commit
8ef5340635
|
@ -115,14 +115,19 @@ export class StateService<
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get all likely authenticated accounts
|
||||||
|
const authenticatedAccounts = (
|
||||||
|
(await this.storageService.get<string[]>(keys.authenticatedAccounts)) ?? []
|
||||||
|
).filter((account) => account != null);
|
||||||
|
|
||||||
await this.updateState(async (state) => {
|
await this.updateState(async (state) => {
|
||||||
state.authenticatedAccounts =
|
for (const i in authenticatedAccounts) {
|
||||||
(await this.storageService.get<string[]>(keys.authenticatedAccounts)) ?? [];
|
state = await this.syncAccountFromDisk(authenticatedAccounts[i]);
|
||||||
for (const i in state.authenticatedAccounts) {
|
|
||||||
if (i != null) {
|
|
||||||
state = await this.syncAccountFromDisk(state.authenticatedAccounts[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// After all individual accounts have been added
|
||||||
|
state.authenticatedAccounts = authenticatedAccounts;
|
||||||
|
|
||||||
const storedActiveUser = await this.storageService.get<string>(keys.activeUserId);
|
const storedActiveUser = await this.storageService.get<string>(keys.activeUserId);
|
||||||
if (storedActiveUser != null) {
|
if (storedActiveUser != null) {
|
||||||
state.activeUserId = storedActiveUser;
|
state.activeUserId = storedActiveUser;
|
||||||
|
|
Loading…
Reference in New Issue