Skip to content

refactor(forms): add a debug name to form and FormField#68716

Open
hawkgs wants to merge 1 commit into
angular:mainfrom
hawkgs:forms/debug-name
Open

refactor(forms): add a debug name to form and FormField#68716
hawkgs wants to merge 1 commit into
angular:mainfrom
hawkgs:forms/debug-name

Conversation

@hawkgs
Copy link
Copy Markdown
Member

@hawkgs hawkgs commented May 13, 2026

Add a debug name option (debugName) to form and FormField that can be used for the clustering of all internal signal nodes in Angular DevTools.

Note: Due to limitations related to the reactive nature of FormField, each form field gets a default index-based debug name.


Unfortunately, I had to move a significant part of the class property definitions in the constructors due to used before initialization errors, which caused the a bigger diff.

The overall implications of keeping these debug names may have negative effects on the framework DX. I've been thinking about alternative solutions like excluding all internal FW signals by default from the signal graph consumed by DevTools, and including only those that are explicitly marked/included by the developer. This is a matter of a discussion though.

@hawkgs hawkgs requested review from JeanMeche, alxhub and leonsenft May 13, 2026 12:57
@ngbot ngbot Bot added this to the Backlog milestone May 13, 2026
@hawkgs hawkgs changed the title refactor(forms): add debug name to form and FormField refactor(forms): add a debug name to form and FormField May 13, 2026
@hawkgs hawkgs added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label May 13, 2026
Add a debug name to `form` and `FormField` that can be used for the clustering of all internal signal nodes in Angular DevTools.

Note: Due to limitations related to the reactive nature of `FormField`, each form field gets a default index-based debug name.
@hawkgs hawkgs force-pushed the forms/debug-name branch from 06d00ed to 1a6bef4 Compare May 13, 2026 14:03
Comment on lines 262 to 267
get required(): Signal<boolean> {
return this.metadata(REQUIRED) ?? FALSE;
return (
this.metadata(REQUIRED) ??
(ngDevMode ? computed(() => false, formDebugObj(this.debugName, 'FALSE')) : FALSE)
);
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any objections to converting getters like this one to a readonly property in order to avoid computed recreation in dev mode on access?

@hawkgs hawkgs removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant