1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-08 19:43:45 +00:00

[AC-2559] - BUG - Refactor members search observable chains (#9230)

* fix: update observable chains for search, refs AC-2559

* fix: remove comment, reorganize variables, refs AC-2559

* chore: remove ngOnInit from base people component, refs AC-2559

* chore: remove async declaration from resetPaging, refs AC-2559

* chore: replace bit-search ngmodel with formControl, refs AC-2559

* chore: move destroy pattern out of base class, refs AC-2559

* fix: remove ngOnDestroy super call, refs AC-2559

* Improve performance issues

---------

Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
This commit is contained in:
Vincent Salucci
2024-05-23 09:05:58 -05:00
committed by GitHub
parent 92b70d983d
commit 8335d8f484
5 changed files with 40 additions and 72 deletions

View File

@@ -1,7 +1,7 @@
<app-header>
<bit-search
class="tw-grow"
[(ngModel)]="searchText"
[formControl]="searchControl"
[placeholder]="'searchMembers' | i18n"
></bit-search>
@@ -48,9 +48,9 @@
<ng-container
*ngIf="
!loading &&
(isPaging()
((isPaging$ | async)
? pagedUsers
: (users | search: searchText : 'name' : 'email' : 'id')) as searchedUsers
: (users | search: searchControl.value : 'name' : 'email' : 'id')) as searchedUsers
"
>
<p *ngIf="!searchedUsers.length">{{ "noMembersInList" | i18n }}</p>
@@ -66,7 +66,7 @@
<bit-table
infinite-scroll
[infiniteScrollDistance]="1"
[infiniteScrollDisabled]="!isPaging()"
[infiniteScrollDisabled]="!(isPaging$ | async)"
(scrolled)="loadMore()"
>
<ng-container header>

View File

@@ -9,6 +9,7 @@ import {
map,
Observable,
shareReplay,
Subject,
switchMap,
takeUntil,
} from "rxjs";
@@ -94,6 +95,8 @@ export class PeopleComponent extends BasePeopleComponent<OrganizationUserView> {
protected canUseSecretsManager$: Observable<boolean>;
private destroy$ = new Subject<void>();
constructor(
apiService: ApiService,
private route: ActivatedRoute,
@@ -194,7 +197,7 @@ export class PeopleComponent extends BasePeopleComponent<OrganizationUserView> {
await this.load();
this.searchText = qParams.search;
this.searchControl.setValue(qParams.search);
if (qParams.viewEvents != null) {
const user = this.users.filter((u) => u.id === qParams.viewEvents);
if (user.length > 0 && user[0].status === OrganizationUserStatusType.Confirmed) {
@@ -210,7 +213,8 @@ export class PeopleComponent extends BasePeopleComponent<OrganizationUserView> {
}
ngOnDestroy(): void {
super.ngOnDestroy();
this.destroy$.next();
this.destroy$.complete();
}
async load() {