From 9a6c80c765c501d4f60114e7e10545b3ca9d722c Mon Sep 17 00:00:00 2001 From: Andrew Schlackman <72105194+sei-aschlackman@users.noreply.github.com> Date: Mon, 1 Apr 2024 17:04:51 -0400 Subject: [PATCH] fix admin view search not loading data when opened in a new tab (#641) --- .../admin-view-search.component.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/app/components/admin-app/admin-view-search/admin-view-search.component.ts b/src/app/components/admin-app/admin-view-search/admin-view-search.component.ts index 4a1f7af..29ecbfc 100644 --- a/src/app/components/admin-app/admin-view-search/admin-view-search.component.ts +++ b/src/app/components/admin-app/admin-view-search/admin-view-search.component.ts @@ -9,6 +9,8 @@ import { View, ViewService, ViewStatus } from '../../../generated/player-api'; import { DialogService } from '../../../services/dialog/dialog.service'; import { LoggedInUserService } from '../../../services/logged-in-user/logged-in-user.service'; import { AdminViewEditComponent } from './admin-view-edit/admin-view-edit.component'; +import { filter, tap } from 'rxjs'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; export interface Action { Value: string; @@ -42,7 +44,15 @@ export class AdminViewSearchComponent implements OnInit { public dialogService: DialogService, public route: ActivatedRoute, public router: Router - ) {} + ) { + this.loggedInUserService.isSuperUser$ + .pipe( + filter((x) => x), + tap(() => this.refreshViews()), + takeUntilDestroyed() + ) + .subscribe(); + } /** * Initialization @@ -58,10 +68,6 @@ export class AdminViewSearchComponent implements OnInit { // Initial datasource this.filterString = ''; - if (this.loggedInUserService.isSuperUser$.getValue()) { - this.refreshViews(); - } - // Check to see if a view was specified in the URL const viewId = this.route.snapshot.queryParamMap.get('view'); if (viewId) {