Skip to content

Commit

Permalink
fix: remove private ɵmarkDirty reference which was removed in angular…
Browse files Browse the repository at this point in the history
… 14.2.

Calling markDirty is not needed any more to support OnPush change detection: angular/angular#10816
  • Loading branch information
Waterstraal committed Sep 20, 2022
1 parent f6f303a commit eec042a
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions projects/ngx-sub-form/src/lib/create-form.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { ɵmarkDirty as markDirty } from '@angular/core';
import { UntypedFormControl } from '@angular/forms';
import isEqual from 'fast-deep-equal';
import { getObservableLifecycle } from 'ngx-observable-lifecycle';
import { combineLatest, concat, defer, EMPTY, forkJoin, identity, merge, Observable, of, timer } from 'rxjs';
import { combineLatest, concat, EMPTY, identity, merge, Observable, of, timer } from 'rxjs';
import {
catchError,
delay,
exhaustMap,
filter,
finalize,
ignoreElements,
map,
mapTo,
shareReplay,
Expand Down Expand Up @@ -220,18 +215,6 @@ export function createForm<ControlInterface, FormInterface>(
formGroup.reset(value, { emitEvent: false });
}),
),
supportChangeDetectionStrategyOnPush: concat(
lifecyleHooks.afterViewInit.pipe(take(1)),
merge(controlValue$, setDisabledState$).pipe(
delay(0),
tap(() => {
// support `changeDetection: ChangeDetectionStrategy.OnPush`
// on the component hosting a form
// fixes https://github.com/cloudnc/ngx-sub-form/issues/93
markDirty(componentInstance);
}),
),
),
setDisabledState$: setDisabledState$.pipe(
tap((shouldDisable: boolean) => {
shouldDisable ? formGroup.disable({ emitEvent: false }) : formGroup.enable({ emitEvent: false });
Expand Down

0 comments on commit eec042a

Please sign in to comment.