From c47fd6ad852ba790c8d7ca8afefb6dc411698d32 Mon Sep 17 00:00:00 2001 From: arturovt Date: Wed, 20 May 2026 21:40:46 +0300 Subject: [PATCH] perf(forms): avoid redundant invalidations in parser errors signal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `errors` linkedSignal in `createParser` had no equality check, so every reset or recomputation — even to an identical empty array — would mark downstream dependents as dirty and trigger unnecessary re-renders. Add `shallowArrayEquals` as the equality function so the signal only notifies dependents when the error list actually changes. --- packages/forms/signals/src/util/parser.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/forms/signals/src/util/parser.ts b/packages/forms/signals/src/util/parser.ts index b7120d36b69b..bd254f03772d 100644 --- a/packages/forms/signals/src/util/parser.ts +++ b/packages/forms/signals/src/util/parser.ts @@ -10,6 +10,7 @@ import {type Signal, linkedSignal} from '@angular/core'; import type {ValidationError} from '../api/rules'; import {normalizeErrors} from '../api/rules/validation/util'; import type {ParseResult} from '../api/transformed_value'; +import {shallowArrayEquals} from './array'; /** * An object that handles parsing raw UI values into model values. @@ -45,6 +46,7 @@ export function createParser( const errors = linkedSignal({ source: getValue, computation: () => [] as readonly ValidationError.WithoutFieldTree[], + equal: shallowArrayEquals, }); const setRawValue = (rawValue: TRaw) => {