Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: loads all projects when membership dialog is opened (DEV-3268) #1450

Merged
merged 5 commits into from
Feb 13, 2024
Merged
20 changes: 17 additions & 3 deletions apps/dsp-app/src/app/user/membership/membership.component.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
import { Component, EventEmitter, Input, OnDestroy, Output } from '@angular/core';
import {
AfterViewInit,
ChangeDetectionStrategy,
Component,
EventEmitter,
Input,
OnDestroy,
Output,
} from '@angular/core';
import { Constants, ReadUser, StoredProject } from '@dasch-swiss/dsp-js';
import { PermissionsData } from '@dasch-swiss/dsp-js/src/models/admin/permissions-data';
import {
AddUserToProjectMembershipAction,
LoadProjectsAction,
ProjectsSelectors,
RemoveUserFromProjectAction,
UserSelectors,
} from '@dasch-swiss/vre/shared/app-state';
import { Select, Store } from '@ngxs/store';
import { combineLatest, Observable, Subject } from 'rxjs';
import { Observable, Subject, combineLatest } from 'rxjs';
import { map, takeUntil } from 'rxjs/operators';
import { AutocompleteItem } from '../../workspace/search/operator';

@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'app-membership',
template: `
<dasch-swiss-app-progress-indicator *ngIf="isMembershipLoading$ | async"></dasch-swiss-app-progress-indicator>
Expand Down Expand Up @@ -67,7 +77,7 @@ import { AutocompleteItem } from '../../workspace/search/operator';
`,
styleUrls: ['./membership.component.scss'],
})
export class MembershipComponent implements OnDestroy {
export class MembershipComponent implements AfterViewInit, OnDestroy {
private ngUnsubscribe = new Subject<void>();

selectedValue: string | null = null;
Expand Down Expand Up @@ -96,6 +106,10 @@ export class MembershipComponent implements OnDestroy {

constructor(private _store: Store) {}

ngAfterViewInit() {
setTimeout(() => this._store.dispatch(new LoadProjectsAction()));
}
irmastnt marked this conversation as resolved.
Show resolved Hide resolved

ngOnDestroy() {
this.ngUnsubscribe.next();
this.ngUnsubscribe.complete();
Expand Down