1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

[PM-8379] Update vault popup items service to track loading state (#9528)

This commit is contained in:
Shane Melton
2024-06-10 09:55:12 -07:00
committed by GitHub
parent 7fb9408202
commit 19f2d2aefc
3 changed files with 78 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
import { Observable, Subject, Subscription, firstValueFrom, throwError, timeout } from "rxjs";
import { firstValueFrom, Observable, Subject, Subscription, throwError, timeout } from "rxjs";
/** Test class to enable async awaiting of observable emissions */
export class ObservableTracker<T> {
@@ -43,6 +43,9 @@ export class ObservableTracker<T> {
private trackEmissions(observable: Observable<T>): T[] {
const emissions: T[] = [];
this.emissionReceived.subscribe((value) => {
emissions.push(value);
});
this.subscription = observable.subscribe((value) => {
if (value == null) {
this.emissionReceived.next(null);
@@ -64,9 +67,7 @@ export class ObservableTracker<T> {
}
}
});
this.emissionReceived.subscribe((value) => {
emissions.push(value);
});
return emissions;
}
}