Skip to content

Commit

Permalink
Add distinctUntilChanged to pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
Exitare committed Jan 27, 2025
1 parent 25817b0 commit 02a4661
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libs/shared/directives/src/validate-input.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Directive, ElementRef, inject, OnInit, Renderer2 } from '@angular/core'
import { AbstractControl, NgControl } from '@angular/forms';
import { SubscriptionHandler } from '@keira/shared/utils';
import { ValidationService } from '@keira/shared/common-services';
import { distinctUntilChanged } from 'rxjs';

@Directive({
selector: '[keiraInputValidation]',
Expand All @@ -23,7 +24,7 @@ export class InputValidationDirective extends SubscriptionHandler implements OnI
}

this.subscriptions.push(
control.statusChanges?.subscribe(() => {
control.statusChanges?.pipe(distinctUntilChanged()).subscribe(() => {
this.updateErrorMessage(control);
}),
);
Expand Down

0 comments on commit 02a4661

Please sign in to comment.