Migration to new Angular Control Flow syntax #3997
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
References
Resolve #3674
Description
Migration to new Angular control flow syntax to improve readbility, type checks on Html , performances and bundle size.
Instructions for Reviewers/List of changes in this PR:
Migrated all templates and import to new syntax.
Removed all NgIf/NgFor/NgForOf/NgSwitch directives and related imports.
Added new lint rule to enforce new syntax.
Functionalities remain unaltered.
To test the rendering improvements was quite difficult as they are not really noticeable on small lists.
Therefore I mocked a list of ca. 1000 elements in /admin/registries/metadata (table with NgFor).
I did run then several tests comparing the two version (old/new) with different methods (tested in CSR):
I did set up a mutation observer that would mark the start and the end of the performance measurament when the first and the last item in the list would enter the DOM.
The rendering time could vary based on different facotrs e.g. machine used, memory allocation etc. , so I tried to run the tests in the most similar conditions on a local machine.
In general here the render time is very similar but I will list the two best results I got (duration value is in millisecond):
Old Syntax
{
"name": "render list",
"entryType": "measure",
"startTime": 14961.10000000149,
"duration": 20.299999999254942
}
New Syntax
{
"name": "render list",
"entryType": "measure",
"startTime": 13188.5,
"duration": 19.399999998509884
}
I have then performed some tests on with the Lightouse extension from Google , we can notice that the time also here is very similar but the total blocking time seems reduce.
Best two results I could gather:
Old syntax
New Syntax