René's URL Explorer Experiment
Title: feat(forms): add `derive()` schema rule for signal forms by JeanMeche · Pull Request #72154 · angular/angular · GitHub
Open Graph Title: feat(forms): add `derive()` schema rule for signal forms by JeanMeche · Pull Request #72154 · angular/angular
X Title: feat(forms): add `derive()` schema rule for signal forms by JeanMeche · Pull Request #72154 · angular/angular
Description: Description
Draft prototype proposing a declarative derive() schema rule in @angular/forms/signals to address #65467 (updating a form field's value from other fields or external signals without user-written effect() blocks).
Proposed API
Two progressive overloads matching existing rules (validate, min, disabled, validateAsync) and Angular's linkedSignal mental model:
form(model, (p) => {
// 1. Shorthand (reactive computation; `linkedSignal(fn)` semantics)
derive(p.total, ({valueOf}) => valueOf(p.quantity) * valueOf(p.unitPrice));
// 2. Shorthand + config
derive(p.slug, ({valueOf}) => slugify(valueOf(p.title)), {
when: ({state}) => !state.dirty(),
});
// 3. Source-driven options (`source` tracked, `compute` runs untracked)
derive(p.state, {
source: p.country, // accepts SchemaPath, LogicFn, or Signal
on: 'change', // preserves initial/hydrated value; narrows `ctx.previous` as defined
fieldState: 'reset', // clears dirty/touched/parseErrors when updated
compute: (country, {previous}) =>
statesByCountry[country]?.includes(previous.value) ? previous.value : '',
});
});
Config options
when: Reactive guard (LogicFn). Inactive rules do not evaluate source/compute.
on: 'always' (default, runs on activation and on changes) or 'change' (captures active snapshot as baseline on initial activation and on when re-activation, only writes on subsequent changes while active; TypeScript narrows ctx.previous to non-nullable {source, value}).
equal: Custom ValueEqualityFn for comparing target values (defaults to Object.is).
sourceEqual: Custom ValueEqualityFn for comparing successive source values (defaults to Object.is).
fieldState: Interaction state behavior on write — 'preserve' (default), 'reset' (clears dirty, touched, parse errors and cascades to descendants), or 'dirty'.
Key Behavioral & Architectural Details
Per-field effect() via createManagedMetadataKey: Mirrors validateAsync's lifecycle (node.structure.injector), so each derivation only re-runs when its own tracked inputs change (O(1) in applyEach arrays), cleans up automatically when fields become orphaned, and composes naturally with schema(), apply(), applyEach(), applyWhen(), applyWhenValue(), and recursive schemas.
Why not a single root polling effect() + hybrid sync flush? A root polling loop re-evaluates every derivation in the form on any change, an eager sync flush during form() construction throws NG0950 when reading input.required(), and hybrid flushing creates split sync-vs-async timing between field.value.set() and model.set() / external signals.
Why not user-written effect() outside form()? It does not compose with schema(), applyEach(), or applyWhen(), lacks per-item cleanup, and pushes untracked() / on: 'change' / reset() re-baselining boilerplate onto every caller.
Multiple rules per field: Coexist in declaration order (trim → toLowerCase → slice pipeline, or multiple triggers driving the same field).
Availability states: Unlike validators, derive() continues to run when a field is readonly, disabled, or hidden (enabling readonly(p.total) + derive(p.total, ...) and clearing hidden fields).
reset(value): Re-baselines on: 'change' rules inside the reset subtree so loading a new snapshot (e.g. form().reset({country: 'CA', state: 'ON'})) does not wipe 'ON', while on: 'always' rules still settle.
Array element identity: Copies the parent's tracking identitySymbol when replacing an array item object so FieldNode identity (dirty, touched, bindings) is preserved.
Cycle detection: Per-rule microtask write guard throws NG01922 (RuntimeErrorCode.DERIVATION_CYCLE) on non-converging cycles.
Open Discussion Points
Naming: derive vs derived vs compute / link, and compute vs computation (mirroring linkedSignal).
Whether compute in the {source, compute} form should run untracked (implemented here to prevent accidental self-triggers) or tracked (matching linkedSignal).
Whether source should accept bare SchemaPath shorthand (source: p.country) vs strictly LogicFn (({valueOf}) => valueOf(p.country)).
fieldState: 'reset' when the newly derived value happens to equal the existing value (equal(current, next) === true).
Verification
//packages/forms/signals/test/node:test (55 specs in derive.spec.ts + compile-time assertions in types.spec.ts; 639/639 passing)
//packages/forms:forms_api & //packages/forms:forms_errors (updated goldens/public-api/forms/signals/index.api.md)
//packages/forms/signals/test/web:test_lib build verified
//packages/core/test/bundling/forms_signals:symbol_test (0 new symbols — derive() is tree-shaken when unused)
Refs #65467
Open Graph Description: Description
Draft prototype proposing a declarative derive() schema rule in @angular/forms/signals to address #65467 (updating a form field's value from other fields or external signals without...
X Description: Description
Draft prototype proposing a declarative derive() schema rule in @angular/forms/signals to address #65467 (updating a form field's value from other fields or external signals wit...
Opengraph URL: https://github.com/angular/angular/pull/72154
X: @github
direct link
Domain: github.com
IPv4 address: 140.82.113.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:b79d3953-677d-ce01-c055-159ec4518bc4 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9860:1188C0:2F1A84:3DB781:6B06165E |
| html-safe-nonce | 4131e9df9702b3848b134b3ad1ded2cb8e1038ec27c18736c0616994ff4c0021 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5ODYwOjExODhDMDoyRjFBODQ6M0RCNzgxOjZCMDYxNjVFIiwidmlzaXRvcl9pZCI6IjU5Mjg2MzcxMjc2Mzc0NzI4NjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 61dcc30108797da2767873d15f519b38088070ea3cec431ab2891e4c82f07cb2 |
| hovercard-subject-tag | pull_request:5438703137 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | ///pull_requests/show/files |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/angular/angular/pull/72154/files |
| twitter:image | https://avatars.githubusercontent.com/u/1300985?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1300985?s=400&v=4 |
| og:image:alt | Description
Draft prototype proposing a declarative derive() schema rule in @angular/forms/signals to address #65467 (updating a form field's value from other fields or external signals without... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 97d4714e567728e1f85f88b0cf68c89f0f8a3dc41e8869af7aeb8195ad990374 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 866f202ebf7ac5aff8f633417d9fd8a53818a977 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Skip to content | https://github.com/angular/angular/pull/72154/files#start-of-content |
| https://github.com/ |
| Sign in | https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fpull%2F72154%2Ffiles |
| GitHubRepository hosting, code review, and collaboration | https://github.com/platform |
| CopilotAI coding agent for tasks, projects, and automated work | https://github.com/features/copilot |
| ActionsCI/CD and automation | https://github.com/features/actions |
| Code QualityQuality analysis, fixes, and enforcement | https://github.com/features/code-quality |
| CodespacesCloud development environments | https://github.com/features/codespaces |
| Code SecurityVulnerability detection and remediation | https://github.com/security/advanced-security/code-security |
| Secret ProtectionSecret scanning and leak prevention | https://github.com/security/advanced-security/secret-protection |
| All Features | https://github.com/features |
| Documentation | https://docs.github.com/en |
| Training | https://learn.github.com/skills |
| Certifications | https://learn.github.com/credentials |
| Build with Copilot | https://github.com/features/ai |
| Customize Copilot | https://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview |
| Integrations | https://github.com/marketplace |
| Trending repos | https://github.com/trending |
| GitHub Sponsors | https://github.com/open-source/sponsors |
| Developer articles | https://github.com/resources/articles |
| ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place. | https://github.blog/changelog/ |
| Enterprises | https://github.com/enterprise |
| Team | https://github.com/team |
| Startups | https://github.com/enterprise/startups |
| Nonprofits | https://github.com/solutions/industry/nonprofits |
| Healthcare | https://github.com/solutions/industry/healthcare |
| Financial services | https://github.com/solutions/industry/financial-services |
| Manufacturing | https://github.com/solutions/industry/manufacturing |
| Government | https://github.com/solutions/industry/government |
| See all industries | https://github.com/solutions/industry |
| Why GitHub | https://github.com/why-github |
| Customer Stories | https://github.com/customer-stories |
| Business insights | https://github.com/solutions/executive-insights |
| Trust Center | https://github.com/trust-center |
| GitHub Advanced SecurityEnterprise-grade code security | https://github.com/security/advanced-security |
| Copilot for businessEnterprise-grade AI features | https://github.com/features/copilot/copilot-business |
| Premium SupportEnterprise-grade 24/7 support | https://github.com/enterprise/premium-support |
| Documentation | https://docs.github.com/en |
| Resource center | https://github.com/resources |
| Blog | https://github.blog/ |
| Events & webinars | https://github.com/resources/events |
| Community Forum | https://github.com/orgs/community/discussions |
| Customer Stories | https://github.com/customer-stories |
| Integrations | https://github.com/marketplace |
| Customer support | https://help.github.com/ |
| Training | https://learn.github.com/skills |
| GitHub Status | https://www.githubstatus.com/ |
| About | https://github.com/about |
| Partners | https://github.com/partners |
| Changelog | https://github.blog/changelog/ |
| GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub. | https://githubuniverse.com/ |
| Pricing | https://github.com/pricing |
| Sign in | https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fpull%2F72154%2Ffiles |
| Sign up | https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=angular%2Fangular |
| Reload | https://github.com/angular/angular/pull/72154/files |
| Reload | https://github.com/angular/angular/pull/72154/files |
| Reload | https://github.com/angular/angular/pull/72154/files |
| angular | https://github.com/angular |
| angular | https://github.com/angular/angular |
| Code | https://github.com/angular/angular |
| Issues831 (831) | https://github.com/angular/angular/issues |
| Pull requests123 (123) | https://github.com/angular/angular/pulls |
| Discussions | https://github.com/angular/angular/discussions |
| Actions | https://github.com/angular/angular/actions |
| Projects | https://github.com/angular/angular/projects |
| Security and quality40 (40) | https://github.com/angular/angular/security |
| Insights | https://github.com/angular/angular/insights |
| Sign up for GitHub
| https://github.com/signup?return_to=%2Fangular%2Fangular%2Fissues%2Fnew%2Fchoose |
| terms of service | https://docs.github.com/terms |
| privacy statement | https://docs.github.com/privacy |
| Sign in | https://github.com/login?return_to=%2Fangular%2Fangular%2Fissues%2Fnew%2Fchoose |
| JeanMeche | https://github.com/JeanMeche |
| angular:main | https://github.com/angular/angular/tree/main |
| JeanMeche:feat/signal-forms-derive | https://github.com/JeanMeche/angular/tree/feat/signal-forms-derive |
|
Conversation
0
| https://github.com/angular/angular/pull/72154 |
|
Commits
1
| https://github.com/angular/angular/pull/72154/commits |
|
Checks
19
| https://github.com/angular/angular/pull/72154/checks |
|
Files changed
7
| https://github.com/angular/angular/pull/72154/files |
|
feat(forms): add derive() schema rule for signal forms
| https://github.com/angular/angular/pull/72154/files#top |
|
Show all changes
1 commit
| https://github.com/angular/angular/pull/72154/files |
|
1fe6d00
feat(forms): add `derive()` schema rule for signal forms
JeanMeche Nov 22, 2026
| https://github.com/angular/angular/pull/72154/commits/1fe6d00b9370f1e1c371d2bc1edced69b4715041 |
|
Clear filters
| https://github.com/angular/angular/pull/72154/files |
| Please reload this page | https://github.com/angular/angular/pull/72154/files |
| Please reload this page | https://github.com/angular/angular/pull/72154/files |
|
index.api.md
| https://github.com/angular/angular/pull/72154/files#diff-a7e7b48ecbb9bc72bc4237f5f1fa21a6862de24552dc43c84a0ed424dae1ac5b |
|
derive.ts
| https://github.com/angular/angular/pull/72154/files#diff-105cb278a87a31ce658762e5120beddaa91d327ab6158ca332033e0dda299782 |
|
index.ts
| https://github.com/angular/angular/pull/72154/files#diff-af6da0f8aceebcce8f3f85e46fd82aac6b0247b085eda1fe9caadd74171079ed |
|
errors.ts
| https://github.com/angular/angular/pull/72154/files#diff-0ee8d19f0d55cb7de2a430738bce492e83b48324b98e9f172b836163bd204bb2 |
|
node.ts
| https://github.com/angular/angular/pull/72154/files#diff-cf828355a749713d8275810e50e46677fd00e6358a7abe7e62b975ab240d70b4 |
|
derive.spec.ts
| https://github.com/angular/angular/pull/72154/files#diff-90f9678c4ec1cee576b1fab1d1f8e145c4507307b77c0132a8aef6629890406a |
|
types.spec.ts
| https://github.com/angular/angular/pull/72154/files#diff-ad44551a4a9950e0f2afb67cc9c8826188626383194484eb951d0f9d60ccaf28 |
| goldens/public-api/forms/signals/index.api.md | https://github.com/angular/angular/pull/72154/files#diff-a7e7b48ecbb9bc72bc4237f5f1fa21a6862de24552dc43c84a0ed424dae1ac5b |
|
View file
| https://github.com/angular/angular/blob/1fe6d00b9370f1e1c371d2bc1edced69b4715041/goldens/public-api/forms/signals/index.api.md |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/angular/angular/pull/72154/{{ revealButtonHref }} |
|
| https://github.com/angular/angular/pull/72154/files#diff-a7e7b48ecbb9bc72bc4237f5f1fa21a6862de24552dc43c84a0ed424dae1ac5b |
|
| https://github.com/angular/angular/pull/72154/files#diff-a7e7b48ecbb9bc72bc4237f5f1fa21a6862de24552dc43c84a0ed424dae1ac5b |
|
| https://github.com/angular/angular/pull/72154/files#diff-a7e7b48ecbb9bc72bc4237f5f1fa21a6862de24552dc43c84a0ed424dae1ac5b |
|
| https://github.com/angular/angular/pull/72154/files#diff-a7e7b48ecbb9bc72bc4237f5f1fa21a6862de24552dc43c84a0ed424dae1ac5b |
|
| https://github.com/angular/angular/pull/72154/files#diff-a7e7b48ecbb9bc72bc4237f5f1fa21a6862de24552dc43c84a0ed424dae1ac5b |
|
| https://github.com/angular/angular/pull/72154/files#diff-a7e7b48ecbb9bc72bc4237f5f1fa21a6862de24552dc43c84a0ed424dae1ac5b |
| Please reload this page | https://github.com/angular/angular/pull/72154/files |
| Please reload this page | https://github.com/angular/angular/pull/72154/files |
|
| https://github.com |
| Terms | https://docs.github.com/site-policy/github-terms/github-terms-of-service |
| Privacy | https://docs.github.com/site-policy/privacy-policies/github-privacy-statement |
| Security | https://github.com/security |
| Status | https://www.githubstatus.com/ |
| Community | https://github.community/ |
| Docs | https://docs.github.com/ |
| Contact | https://support.github.com?tags=dotcom-footer |
Response headers:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width
URLs of crawlers that visited me.