perf(forms): optimize [field] binding instructions#64351
perf(forms): optimize [field] binding instructions#64351leonsenft wants to merge 1 commit intoangular:mainfrom
[field] binding instructions#64351Conversation
| if (isComponentHost(tNode)) { | ||
| const componentDef = tView.data[componentIndex] as ComponentDef<unknown>; | ||
| // TODO: should we check that any additional field state inputs are signal based? | ||
| if (hasModelInput(componentDef, 'value')) { |
There was a problem hiding this comment.
Should we be concerned about property renaming here? I'm guessing no, but it's worth double checking.
There was a problem hiding this comment.
Are you concerned about the 'value' string literal here? It's the public/template name of the input used as a key for
angular/packages/core/src/render3/interfaces/definition.ts
Lines 109 to 116 in 84f6e36
My understanding is that this preserves the public/template name so that inputs can be matched at runtime, then this map is used to map to their minified names.
|
|
||
| if (isComponentHost(tNode)) { | ||
| const componentDef = tView.data[componentIndex] as ComponentDef<unknown>; | ||
| // TODO: should we check that any additional field state inputs are signal based? |
There was a problem hiding this comment.
I believe the previous hacky implementation did, and this one probably should too
There was a problem hiding this comment.
Right, but does it need to? This code works if the inputs aren't signal based since we go through writeToDirectiveInput which handles the disambiguation.
The only reason we might want/need to check is that it ensures the custom types conforms to the FormUiControl interface, but that seems like a guideline anyways since we can't used that to determine whether it's a custom control at runtime anyways.
Caches information about the kind of form control that a `TNode` represents in `TNodeFlags`. This avoids redundant computations on subsequent template create and update passes. Renames the `INVALID_CONTROL_HOST` error code to `INVALID_FIELD_DIRECTIVE_HOST` for clarity and adds a test for it.
78ea6c4 to
d5dc8f2
Compare
|
This PR was merged into the repository. The changes were merged into the following branches:
|
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Caches information about the kind of form control that a
TNoderepresents inTNodeFlags. This avoids redundant computations on subsequent template create and update passes.Renames the
INVALID_CONTROL_HOSTerror code toINVALID_FIELD_DIRECTIVE_HOSTfor clarity and adds a test for it.