fix(core): allow null / undefined values in query results (#35796)

Before this change ngIvy implementation of queries would throw upon
encountering null / undefined query result collected from an embedded
view. It turns out that we might have a provider that explicitly provides
a null / undefined value in a place of a token queried for.

This commit removes a check from the ngIvy query implementation that was
asserting on a query result to be defined.

Fixes #35673

PR Close #35796
This commit is contained in:
Pawel Kozlowski
2020-03-02 15:55:58 +01:00
committed by atscott
parent 44e47da4cf
commit 5652fb1018
2 changed files with 73 additions and 3 deletions

View File

@ -363,9 +363,7 @@ function collectQueryResults<T>(tView: TView, lView: LView, queryIndex: number,
for (let i = 0; i < tQueryMatches.length; i += 2) {
const tNodeIdx = tQueryMatches[i];
if (tNodeIdx > 0) {
const viewResult = lViewResults[i / 2];
ngDevMode && assertDefined(viewResult, 'materialized query result should be defined');
result.push(viewResult as T);
result.push(lViewResults[i / 2] as T);
} else {
const childQueryIndex = tQueryMatches[i + 1];