Sitelet https://github.com/angular/angular/pull/70299
Skip to content

feat(forms): add custom equality function for signal forms - #70299

Open
brysonbw wants to merge 1 commit into
angular:mainfrom
brysonbw:feat-signal-forms-equal-function-69928
Open

feat(forms): add custom equality function for signal forms#70299
brysonbw wants to merge 1 commit into
angular:mainfrom
brysonbw:feat-signal-forms-equal-function-69928

Conversation

@brysonbw

@brysonbw brysonbw commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Signal Forms currently use reference equality for object values. If a new object instance represents the same logical value, the form still treats it as a change and updates dependent signals

Issue Number: #69928

What is the new behavior?

Adds a custom equality() rule that allows callers to define custom value comparison logic for fields:

  • Fields can opt into custom equality checks.
  • Values that compare as equal no longer replace the current field value.
  • Dependent signals are not notified when the comparator reports no change.
  • Custom equality logic is consistently applied across nested fields, array items, conditional rules, and deepSignal updates.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Extracted the shared, dependency-free metadata primitives (MetadataKey, MetadataReducer, createMetadataKey, IS_ASYNC_VALIDATION_RESOURCE, LimitKey, LimitSelectionKey, MetadataSetterType) into a new schema/metadata.ts module. This decoupling is required (imo) because the new EQUALITY MetadataKey needs to be read directly within the schema layer (schema/logic_node.ts) to retrieve the configured equality function during change detection

Allow Signal Forms fields to use custom equality functions for programmatic updates. Preserve equivalent object values, including Temporal.PlainDate.
@brysonbw
brysonbw force-pushed the feat-signal-forms-equal-function-69928 branch from aa08656 to 2a6795a Compare August 20, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: forms detected: feature PR contains a feature commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant