[bug] Always set environementUrls from client when scaffolding an account (#624)

There is a use case that overrides locally set environmentUrls: an initial boot of a logged out application.
We override environmentUrls with whatever the tempory settings store has, even if different urls are added before authenticating.
This commit ensures we always use input environmentUrls.
This commit is contained in:
Addison Beck 2022-01-21 11:14:34 -05:00 committed by GitHub
parent e1bdd2a95c
commit 69fe7b8339
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -2210,14 +2210,15 @@ export class StateService<TAccount extends Account = Account>
account.profile.userId,
await this.defaultOnDiskLocalOptions()
);
// EnvironmentUrls are set before authenticating and should override whatever is stored from any previous session
const environmentUrls = account.settings.environmentUrls;
if (storedAccount?.settings != null) {
// EnvironmentUrls are set before authenticating and should override whatever is stored from last session
storedAccount.settings.environmentUrls = account.settings.environmentUrls;
account.settings = storedAccount.settings;
} else if (await this.storageService.has(keys.tempAccountSettings)) {
account.settings = await this.storageService.get<any>(keys.tempAccountSettings);
await this.storageService.remove(keys.tempAccountSettings);
}
account.settings.environmentUrls = environmentUrls;
await this.storageService.save(
account.profile.userId,
account,