-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
bugSomething isn't workingSomething isn't working
Description
So I have this class I extend most of my "smart" components from.
import { OnInit, OnDestroy } from '@angular/core';
import { Store, Action } from '@ngrx/store';
import { Subject, merge, Observable } from 'rxjs';
import { takeUntil, filter } from 'rxjs/operators';
export const isOnInit = () => filter((l) => l === 'OnInit');
export const isOnDestroy = () => filter((l) => l === 'OnDestroy');
export class BaseClass implements OnInit, OnDestroy {
lifecycle$ = new Subject<'OnInit' | 'OnDestroy'>();
ngOnInit() {
this.lifecycle$.next('OnInit');
}
ngOnDestroy() {
this.lifecycle$.next('OnDestroy');
this.lifecycle$.complete();
}
dispatchActions$$(store: Store<any>, actions: Observable<Action>[]) {
merge(...actions)
.pipe(takeUntil(this.lifecycle$.pipe(isOnDestroy())))
.subscribe(store);
}
}as soon as @ObservableEvent() is used inside a class that extends from this class I don't get the OnDestroy message from lifecycle$
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working