angular-update-guide icon indicating copy to clipboard operation
angular-update-guide copied to clipboard

Missing update hint when updating to Angular 9

Open GeorgeKnap opened this issue 6 years ago • 0 comments

Since Ivy doesn't support patching lifecycle hooks there should be one more migration checkbox hint to remind users of that fact.

I used to have a small function to automatically unsubscribe from observables

export function componentDestroyed(component: Destroyable): Subject<any> {
    if (component.unsubscribeSubject$) {
        return component.unsubscribeSubject$;
    }
    const oldNgOnDestroy = component.ngOnDestroy;
    component.unsubscribeSubject$ = new Subject();
    component.ngOnDestroy = () => {
        if (oldNgOnDestroy) {
            oldNgOnDestroy.apply(component);
        }

        component.unsubscribeSubject$.next(undefined);
        component.unsubscribeSubject$.complete();
    };
    return component.unsubscribeSubject$;
}

which was used like takeUntil(componentDestroyed(this))

in Angular 9 that does not work anymore.

GeorgeKnap avatar Mar 08 '20 08:03 GeorgeKnap