1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-13 23:13:36 +00:00
This commit is contained in:
Bernd Schoolmann
2026-01-08 17:26:06 +01:00
parent fcc2844a16
commit c4ba46242e
4 changed files with 52 additions and 8 deletions

View File

@@ -143,12 +143,24 @@ export class VaultV2Component implements OnInit, AfterViewInit, OnDestroy {
* @protected
*/
protected loading$ = combineLatest([
this.vaultPopupLoadingService.loading$,
this.readySubject.asObservable(),
this.vaultPopupLoadingService.loading$
.pipe(tap((loading) => {
console.log("vault loading service state:", loading);
})),
this.readySubject.asObservable()
.pipe(
tap((ready) => {
console.log("vault ready state:", ready);
}),
)
]).pipe(
tap(([loading, ready]) => {
console.log("vault loading state:", { loading, ready });
}),
map(([loading, ready]) => loading || !ready),
distinctUntilChanged(),
tap((loading) => {
console.log("vault loading final state:", loading);
const key = loading ? "loadingVault" : "vaultLoaded";
void this.liveAnnouncer.announce(this.i18nService.translate(key), "polite");
}),

View File

@@ -257,8 +257,16 @@ export class VaultPopupItemsService {
* Observable that indicates whether the service is currently loading ciphers.
*/
loading$: Observable<boolean> = merge(
this._ciphersLoading$.pipe(map(() => true)),
this.remainingCiphers$.pipe(map(() => false)),
this._ciphersLoading$.pipe(
tap(() => {
console.log("[vault popup items service] ciphers loading started");
}),
map(() => true)),
this.remainingCiphers$.pipe(
tap(() => {
console.log("[vault popup items service] ciphers loading finished");
}),
map(() => false)),
).pipe(startWith(true), distinctUntilChanged(), shareReplay({ refCount: false, bufferSize: 1 }));
/** Observable that indicates whether there is search text present.

View File

@@ -1,5 +1,5 @@
import { inject, Injectable } from "@angular/core";
import { combineLatest, map, shareReplay, startWith } from "rxjs";
import { combineLatest, map, shareReplay, startWith,tap } from "rxjs";
import { VaultPopupCopyButtonsService } from "./vault-popup-copy-buttons.service";
import { VaultPopupItemsService } from "./vault-popup-items.service";
@@ -15,12 +15,24 @@ export class VaultPopupLoadingService {
/** Loading state of the vault */
loading$ = combineLatest([
this.vaultPopupItemsService.loading$,
this.vaultPopupListFiltersService.allFilters$,
this.vaultPopupItemsService.loading$
.pipe(tap(loading => {
console.log("[vault popup loading service] vault popup items loading state:", loading);
})),
this.vaultPopupListFiltersService.allFilters$
.pipe(tap(loading => {
console.log("[vault popup loading service] vault poupuplist items loading state:", loading);
})),
// Added as a dependency to avoid flashing the copyActions on slower devices
this.vaultCopyButtonsService.showQuickCopyActions$,
this.vaultCopyButtonsService.showQuickCopyActions$
.pipe(tap(loading => {
console.log("[vault popup loading service] vault copy buttons loading state:", loading);
})),
]).pipe(
map(([itemsLoading, filters]) => itemsLoading || !filters),
tap(loading => {
console.log("[vault popup loading service] combined vault loading state:", loading);
}),
shareReplay({ bufferSize: 1, refCount: true }),
startWith(true),
);

View File

@@ -12,6 +12,7 @@ import {
shareReplay,
switchMap,
take,
tap,
} from "rxjs";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
@@ -116,10 +117,12 @@ export class VaultItemsComponent<C extends CipherViewLike> implements OnDestroy
this.deleted = deleted ?? false;
this.archived = archived;
await this.applyFilter(filter);
console.log("set loaded", { filter, deleted, archived });
this.loaded = true;
}
async reload(filter: (cipher: C) => boolean = null, deleted = false, archived = false) {
console.log("reload", { filter, deleted, archived });
this.loaded = false;
await this.load(filter, deleted, archived);
}
@@ -182,7 +185,11 @@ export class VaultItemsComponent<C extends CipherViewLike> implements OnDestroy
this.restrictedItemTypesService.restricted$,
]),
),
tap(() => {
console.log("VaultItemsComponent: Loading ciphers...");
}),
switchMap(([indexedCiphers, failedCiphers, searchText, filter, userId, restricted]) => {
console.log("VaultItemsComponent: Applying search and filters...");
let allCiphers = (indexedCiphers ?? []) as C[];
const _failedCiphers = failedCiphers ?? [];
@@ -191,6 +198,7 @@ export class VaultItemsComponent<C extends CipherViewLike> implements OnDestroy
const restrictedTypeFilter = (cipher: CipherViewLike) =>
!this.restrictedItemTypesService.isCipherRestricted(cipher, restricted);
console.log("VaultItemsComponent: Searching ciphers with text:", searchText);
return this.searchService.searchCiphers(
userId,
searchText,
@@ -198,9 +206,13 @@ export class VaultItemsComponent<C extends CipherViewLike> implements OnDestroy
allCiphers,
);
}),
tap((ciphers) => {
console.log("VaultItemsComponent: Found ciphers:", ciphers);
}),
takeUntilDestroyed(),
)
.subscribe((ciphers) => {
console.log("loaded", ciphers);
this.ciphers = ciphers;
this.loaded = true;
});