mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor(core): avoid an empty array allocation during hydration (#51917)
This commit updates hydration runtime code to avoid creating an empty array when we can avoid it. Instead, we just check whether the field is `null` directly (without using nullish coalescing). PR Close #51917
This commit is contained in:
committed by
Dylan Hunn
parent
b8f447e611
commit
68648ee684
@@ -67,8 +67,8 @@ let _findMatchingDehydratedViewImpl: typeof findMatchingDehydratedViewImpl =
|
||||
*/
|
||||
function findMatchingDehydratedViewImpl(
|
||||
lContainer: LContainer, template: string|null): DehydratedContainerView|null {
|
||||
const views = lContainer[DEHYDRATED_VIEWS] ?? [];
|
||||
if (!template || views.length === 0) {
|
||||
const views = lContainer[DEHYDRATED_VIEWS];
|
||||
if (!template || views === null || views.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const view = views[0];
|
||||
|
||||
Reference in New Issue
Block a user