mirror of
https://github.com/bitwarden/browser.git
synced 2025-03-02 03:41:09 +01:00
[PM-5111] Reduce calls to config endpoint (#7069)
* Removed second active account observable and added distinctUntilChanged. * Updated comment.
This commit is contained in:
parent
0aca876b75
commit
299a880cba
@ -1,4 +1,4 @@
|
||||
import { concatMap, Observable, ReplaySubject } from "rxjs";
|
||||
import { concatMap, distinctUntilChanged, Observable, ReplaySubject } from "rxjs";
|
||||
|
||||
import { EnvironmentUrls } from "../../auth/models/domain/environment-urls";
|
||||
import {
|
||||
@ -52,6 +52,8 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
|
||||
constructor(private stateService: StateService) {
|
||||
this.stateService.activeAccount$
|
||||
.pipe(
|
||||
// Use == here to not trigger on undefined -> null transition
|
||||
distinctUntilChanged((oldUserId: string, newUserId: string) => oldUserId == newUserId),
|
||||
concatMap(async () => {
|
||||
if (!this.initialized) {
|
||||
return;
|
||||
|
@ -224,7 +224,6 @@ export class StateService<
|
||||
email: account.profile.email,
|
||||
});
|
||||
await this.setActiveUser(account.profile.userId);
|
||||
this.activeAccountSubject.next(account.profile.userId);
|
||||
}
|
||||
|
||||
async setActiveUser(userId: string): Promise<void> {
|
||||
|
Loading…
Reference in New Issue
Block a user