Skip to content

Commit bb94434

Browse files
AndrewKushnirjasonaden
authored andcommitted
fix(ivy): Content Queries inheritance fix (angular#28324)
Prior to this change contentQueriesRefresh functions that represent refresh logic for @contentquery list were not composable, which caused problems in case one Directive inherits another one and both of them contain Content Queries. Due to the fact that we used indices to reference queries in refresh function, results were placed into wrong Queries. In order to avoid that we no longer use indices to reference queries and instead maintain current content query index while iterating through them. This allows us to compose contentQueriesRefresh functions and make inheritance feature work with Content Queries. PR Close angular#28324
1 parent ebac5db commit bb94434

19 files changed

+224
-190
lines changed

packages/compiler-cli/test/compliance/r3_compiler_compliance_spec.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,14 +1554,14 @@ describe('compiler compliance', () => {
15541554
return new (t || ContentQueryComponent)();
15551555
},
15561556
contentQueries: function ContentQueryComponent_ContentQueries(dirIndex) {
1557-
$r3$.ɵregisterContentQuery($r3$.ɵquery(SomeDirective, true), dirIndex);
1558-
$r3$.ɵregisterContentQuery($r3$.ɵquery(SomeDirective, false), dirIndex);
1557+
$r3$.ɵcontentQuery(dirIndex, SomeDirective, true);
1558+
$r3$.ɵcontentQuery(dirIndex, SomeDirective, false);
15591559
},
1560-
contentQueriesRefresh: function ContentQueryComponent_ContentQueriesRefresh(dirIndex, queryStartIndex) {
1560+
contentQueriesRefresh: function ContentQueryComponent_ContentQueriesRefresh(dirIndex) {
15611561
const instance = $r3$.ɵload(dirIndex);
15621562
var $tmp$;
1563-
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵloadQueryList(queryStartIndex))) && ($instance$.someDir = $tmp$.first));
1564-
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵloadQueryList((queryStartIndex + 1)))) && ($instance$.someDirList = $tmp$));
1563+
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵloadContentQuery())) && ($instance$.someDir = $tmp$.first));
1564+
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵloadContentQuery())) && ($instance$.someDirList = $tmp$));
15651565
},
15661566
ngContentSelectors: _c0,
15671567
consts: 2,
@@ -1613,14 +1613,14 @@ describe('compiler compliance', () => {
16131613
ContentQueryComponent.ngComponentDef = $r3$.ɵdefineComponent({
16141614
16151615
contentQueries: function ContentQueryComponent_ContentQueries(dirIndex) {
1616-
$r3$.ɵregisterContentQuery($r3$.ɵquery($e0_attrs$, true), dirIndex);
1617-
$r3$.ɵregisterContentQuery($r3$.ɵquery($e1_attrs$, false), dirIndex);
1616+
$r3$.ɵcontentQuery(dirIndex, $e0_attrs$, true);
1617+
$r3$.ɵcontentQuery(dirIndex, $e1_attrs$, false);
16181618
},
1619-
contentQueriesRefresh: function ContentQueryComponent_ContentQueriesRefresh(dirIndex, queryStartIndex) {
1619+
contentQueriesRefresh: function ContentQueryComponent_ContentQueriesRefresh(dirIndex) {
16201620
const instance = $r3$.ɵload(dirIndex);
16211621
var $tmp$;
1622-
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵloadQueryList(queryStartIndex))) && (instance.myRef = $tmp$.first));
1623-
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵloadQueryList((queryStartIndex + 1)))) && (instance.myRefs = $tmp$));
1622+
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵloadContentQuery())) && (instance.myRef = $tmp$.first));
1623+
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵloadContentQuery())) && (instance.myRefs = $tmp$));
16241624
},
16251625
16261626
});`;
@@ -1666,18 +1666,18 @@ describe('compiler compliance', () => {
16661666
ContentQueryComponent.ngComponentDef = $r3$.ɵdefineComponent({
16671667
16681668
contentQueries: function ContentQueryComponent_ContentQueries(dirIndex) {
1669-
$r3$.ɵregisterContentQuery($r3$.ɵquery($e0_attrs$ , true, TemplateRef), dirIndex);
1670-
$r3$.ɵregisterContentQuery($r3$.ɵquery(SomeDirective, true, ElementRef), dirIndex);
1671-
$r3$.ɵregisterContentQuery($r3$.ɵquery($e1_attrs$, false, ElementRef), dirIndex);
1672-
$r3$.ɵregisterContentQuery($r3$.ɵquery(SomeDirective, false, TemplateRef), dirIndex);
1669+
$r3$.ɵcontentQuery(dirIndex, $e0_attrs$ , true, TemplateRef);
1670+
$r3$.ɵcontentQuery(dirIndex, SomeDirective, true, ElementRef);
1671+
$r3$.ɵcontentQuery(dirIndex, $e1_attrs$, false, ElementRef);
1672+
$r3$.ɵcontentQuery(dirIndex, SomeDirective, false, TemplateRef);
16731673
},
1674-
contentQueriesRefresh: function ContentQueryComponent_ContentQueriesRefresh(dirIndex, queryStartIndex) {
1674+
contentQueriesRefresh: function ContentQueryComponent_ContentQueriesRefresh(dirIndex) {
16751675
const instance = $r3$.ɵload(dirIndex);
16761676
var $tmp$;
1677-
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵloadQueryList(queryStartIndex))) && (instance.myRef = $tmp$.first));
1678-
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵloadQueryList((queryStartIndex + 1)))) && (instance.someDir = $tmp$.first));
1679-
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵloadQueryList((queryStartIndex + 2)))) && (instance.myRefs = $tmp$));
1680-
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵloadQueryList((queryStartIndex + 3)))) && (instance.someDirs = $tmp$));
1677+
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵloadContentQuery())) && (instance.myRef = $tmp$.first));
1678+
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵloadContentQuery())) && (instance.someDir = $tmp$.first));
1679+
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵloadContentQuery())) && (instance.myRefs = $tmp$));
1680+
($r3$.ɵqueryRefresh(($tmp$ = $r3$.ɵloadContentQuery())) && (instance.someDirs = $tmp$));
16811681
},
16821682
16831683
});`;

packages/compiler-cli/test/ngtsc/ngtsc_spec.ts

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ import {NgtscTestEnvironment} from './env';
1212

1313
const trim = (input: string): string => input.replace(/\s+/g, ' ').trim();
1414

15+
const varRegExp = (name: string): RegExp => new RegExp(`var \\w+ = \\[\"${name}\"\\];`);
16+
17+
const viewQueryRegExp = (descend: boolean, ref?: string): RegExp => {
18+
const maybeRef = ref ? `, ${ref}` : ``;
19+
return new RegExp(`i0\\.ɵviewQuery\\(\\w+, ${descend}${maybeRef}\\)`);
20+
};
21+
22+
const contentQueryRegExp = (predicate: string, descend: boolean, ref?: string): RegExp => {
23+
const maybeRef = ref ? `, ${ref}` : ``;
24+
return new RegExp(`i0\\.ɵcontentQuery\\(dirIndex, ${predicate}, ${descend}${maybeRef}\\)`);
25+
};
26+
1527
describe('ngtsc behavioral tests', () => {
1628
if (!NgtscTestEnvironment.supported) {
1729
// These tests should be excluded from the non-Bazel build.
@@ -706,14 +718,6 @@ describe('ngtsc behavioral tests', () => {
706718
});
707719

708720
it('should generate queries for components', () => {
709-
710-
// Helper functions to construct RegExps for output validation
711-
const varRegExp = (name: string): RegExp => new RegExp(`var \\w+ = \\[\"${name}\"\\];`);
712-
const queryRegExp = (fnName: string, descend: boolean, ref?: string | null): RegExp => {
713-
const maybeRef = ref ? `, ${ref}` : ``;
714-
return new RegExp(`i0\\.ɵ${fnName}\\(\\w+, ${descend}${maybeRef}\\)`);
715-
};
716-
717721
env.tsconfig();
718722
env.write(`test.ts`, `
719723
import {Component, ContentChild, ContentChildren, TemplateRef, ViewChild} from '@angular/core';
@@ -740,23 +744,10 @@ describe('ngtsc behavioral tests', () => {
740744
expect(jsContents).toMatch(varRegExp('test1'));
741745
expect(jsContents).toMatch(varRegExp('test2'));
742746
expect(jsContents).toMatch(varRegExp('accessor'));
743-
expect(jsContents).toContain(`i0.ɵquery(TemplateRef, false)`);
744-
expect(jsContents)
745-
.toMatch(
746-
// match `i0.ɵquery(_c0, true, TemplateRef)`
747-
queryRegExp('query', true, 'TemplateRef'));
748-
expect(jsContents)
749-
.toMatch(
750-
// match `i0.ɵquery(_c0, true)`
751-
queryRegExp('query', true));
752-
expect(jsContents)
753-
.toMatch(
754-
// match `i0.ɵviewQuery(_c0, true)`
755-
queryRegExp('viewQuery', true));
756-
expect(jsContents)
757-
.toMatch(
758-
// match `i0.ɵviewQuery(_c0, true)`
759-
queryRegExp('viewQuery', true));
747+
// match `i0.ɵcontentQuery(dirIndex, _c1, true, TemplateRef)`
748+
expect(jsContents).toMatch(contentQueryRegExp('\\w+', true, 'TemplateRef'));
749+
// match `i0.ɵviewQuery(_c2, true)`
750+
expect(jsContents).toMatch(viewQueryRegExp(true));
760751
});
761752

762753
it('should handle queries that use forwardRef', () => {
@@ -777,8 +768,10 @@ describe('ngtsc behavioral tests', () => {
777768

778769
env.driveMain();
779770
const jsContents = env.getContents('test.js');
780-
expect(jsContents).toContain(`i0.ɵquery(TemplateRef, true)`);
781-
expect(jsContents).toContain(`i0.ɵquery(ViewContainerRef, true)`);
771+
// match `i0.ɵcontentQuery(dirIndex, TemplateRef, true)`
772+
expect(jsContents).toMatch(contentQueryRegExp('TemplateRef', true));
773+
// match `i0.ɵcontentQuery(dirIndex, ViewContainerRef, true)`
774+
expect(jsContents).toMatch(contentQueryRegExp('ViewContainerRef', true));
782775
});
783776

784777
it('should generate host listeners for components', () => {

packages/compiler/src/render3/r3_identifiers.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ export class Identifiers {
116116
static i18nPostprocess: o.ExternalReference = {name: 'ɵi18nPostprocess', moduleName: CORE};
117117

118118
static load: o.ExternalReference = {name: 'ɵload', moduleName: CORE};
119-
static loadQueryList: o.ExternalReference = {name: 'ɵloadQueryList', moduleName: CORE};
120119

121120
static pipe: o.ExternalReference = {name: 'ɵpipe', moduleName: CORE};
122121

@@ -185,12 +184,11 @@ export class Identifiers {
185184

186185
static definePipe: o.ExternalReference = {name: 'ɵdefinePipe', moduleName: CORE};
187186

188-
static query: o.ExternalReference = {name: 'ɵquery', moduleName: CORE};
189187
static queryRefresh: o.ExternalReference = {name: 'ɵqueryRefresh', moduleName: CORE};
190188
static viewQuery: o.ExternalReference = {name: 'ɵviewQuery', moduleName: CORE};
191189
static loadViewQuery: o.ExternalReference = {name: 'ɵloadViewQuery', moduleName: CORE};
192-
static registerContentQuery:
193-
o.ExternalReference = {name: 'ɵregisterContentQuery', moduleName: CORE};
190+
static contentQuery: o.ExternalReference = {name: 'ɵcontentQuery', moduleName: CORE};
191+
static loadContentQuery: o.ExternalReference = {name: 'ɵloadContentQuery', moduleName: CORE};
194192

195193
static NgOnChangesFeature: o.ExternalReference = {name: 'ɵNgOnChangesFeature', moduleName: CORE};
196194

packages/compiler/src/render3/view/compiler.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -496,10 +496,6 @@ function prepareQueryParams(query: R3QueryMetadata, constantPool: ConstantPool):
496496
return parameters;
497497
}
498498

499-
function createQueryDefinition(query: R3QueryMetadata, constantPool: ConstantPool): o.Expression {
500-
return o.importExpr(R3.query).callFn(prepareQueryParams(query, constantPool));
501-
}
502-
503499
// Turn a directive selector into an R3-compatible selector for directive def
504500
function createDirectiveSelector(selector: string | null): o.Expression {
505501
return asLiteral(core.parseSelectorToR3Selector(selector));
@@ -519,10 +515,8 @@ function createContentQueriesFunction(
519515
meta: R3DirectiveMetadata, constantPool: ConstantPool): o.Expression|null {
520516
if (meta.queries.length) {
521517
const statements: o.Statement[] = meta.queries.map((query: R3QueryMetadata) => {
522-
const queryDefinition = createQueryDefinition(query, constantPool);
523-
return o.importExpr(R3.registerContentQuery)
524-
.callFn([queryDefinition, o.variable('dirIndex')])
525-
.toStmt();
518+
const args = [o.variable('dirIndex'), ...prepareQueryParams(query, constantPool) as any];
519+
return o.importExpr(R3.contentQuery).callFn(args).toStmt();
526520
});
527521
const typeName = meta.name;
528522
const parameters = [new o.FnParam('dirIndex', o.NUMBER_TYPE)];
@@ -539,10 +533,7 @@ function createContentQueriesRefreshFunction(meta: R3DirectiveMetadata): o.Expre
539533
if (meta.queries.length > 0) {
540534
const statements: o.Statement[] = [];
541535
const typeName = meta.name;
542-
const parameters = [
543-
new o.FnParam('dirIndex', o.NUMBER_TYPE),
544-
new o.FnParam('queryStartIndex', o.NUMBER_TYPE),
545-
];
536+
const parameters = [new o.FnParam('dirIndex', o.NUMBER_TYPE)];
546537
const directiveInstanceVar = o.variable('instance');
547538
// var $tmp$: any;
548539
const temporary = temporaryAllocator(statements, TEMPORARY_NAME);
@@ -551,11 +542,8 @@ function createContentQueriesRefreshFunction(meta: R3DirectiveMetadata): o.Expre
551542
statements.push(directiveInstanceVar.set(o.importExpr(R3.load).callFn([o.variable('dirIndex')]))
552543
.toDeclStmt(o.INFERRED_TYPE, [o.StmtModifier.Final]));
553544

554-
meta.queries.forEach((query: R3QueryMetadata, idx: number) => {
555-
const loadQLArg = o.variable('queryStartIndex');
556-
const getQueryList = o.importExpr(R3.loadQueryList).callFn([
557-
idx > 0 ? loadQLArg.plus(o.literal(idx)) : loadQLArg
558-
]);
545+
meta.queries.forEach((query: R3QueryMetadata) => {
546+
const getQueryList = o.importExpr(R3.loadContentQuery).callFn([]);
559547
const assignToTemporary = temporary().set(getQueryList);
560548
const callQueryRefresh = o.importExpr(R3.queryRefresh).callFn([assignToTemporary]);
561549

packages/core/src/core_render3_private_export.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ export {
4747
listener as ɵlistener,
4848
text as ɵtext,
4949
embeddedViewStart as ɵembeddedViewStart,
50-
query as ɵquery,
51-
registerContentQuery as ɵregisterContentQuery,
5250
projection as ɵprojection,
5351
bind as ɵbind,
5452
interpolation1 as ɵinterpolation1,
@@ -84,7 +82,8 @@ export {
8482
queryRefresh as ɵqueryRefresh,
8583
viewQuery as ɵviewQuery,
8684
loadViewQuery as ɵloadViewQuery,
87-
loadQueryList as ɵloadQueryList,
85+
contentQuery as ɵcontentQuery,
86+
loadContentQuery as ɵloadContentQuery,
8887
elementEnd as ɵelementEnd,
8988
elementProperty as ɵelementProperty,
9089
componentHostSyntheticProperty as ɵcomponentHostSyntheticProperty,

packages/core/src/render3/definition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export function defineComponent<T>(componentDefinition: {
136136
contentQueries?: ((dirIndex: number) => void);
137137

138138
/** Refreshes content queries associated with directives in a given view */
139-
contentQueriesRefresh?: ((directiveIndex: number, queryIndex: number) => void);
139+
contentQueriesRefresh?: ((directiveIndex: number) => void);
140140

141141
/**
142142
* Defines the name that can be used in the template to assign this directive to a variable.

packages/core/src/render3/features/inherit_definition_feature.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ export function InheritDefinitionFeature(definition: DirectiveDef<any>| Componen
103103
const superContentQueries = superDef.contentQueries;
104104
if (superContentQueries) {
105105
if (prevContentQueries) {
106-
definition.contentQueries = (dirIndex: number) => {
107-
superContentQueries(dirIndex);
108-
prevContentQueries(dirIndex);
106+
definition.contentQueries = (directiveIndex: number) => {
107+
superContentQueries(directiveIndex);
108+
prevContentQueries(directiveIndex);
109109
};
110110
} else {
111111
definition.contentQueries = superContentQueries;
@@ -117,9 +117,9 @@ export function InheritDefinitionFeature(definition: DirectiveDef<any>| Componen
117117
const superContentQueriesRefresh = superDef.contentQueriesRefresh;
118118
if (superContentQueriesRefresh) {
119119
if (prevContentQueriesRefresh) {
120-
definition.contentQueriesRefresh = (directiveIndex: number, queryIndex: number) => {
121-
superContentQueriesRefresh(directiveIndex, queryIndex);
122-
prevContentQueriesRefresh(directiveIndex, queryIndex);
120+
definition.contentQueriesRefresh = (directiveIndex: number) => {
121+
superContentQueriesRefresh(directiveIndex);
122+
prevContentQueriesRefresh(directiveIndex);
123123
};
124124
} else {
125125
definition.contentQueriesRefresh = superContentQueriesRefresh;

packages/core/src/render3/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,12 @@ export {
122122
} from './pipe';
123123

124124
export {
125-
query,
126125
queryRefresh,
127126
viewQuery,
128127
loadViewQuery,
128+
contentQuery,
129+
loadContentQuery,
129130
} from './query';
130-
export {
131-
registerContentQuery,
132-
loadQueryList,
133-
} from './instructions';
134131

135132
export {
136133
pureFunction0,

packages/core/src/render3/instructions.ts

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import {BINDING_INDEX, CLEANUP, CONTAINER_INDEX, CONTENT_QUERIES, CONTEXT, DECLA
3636
import {assertNodeOfPossibleTypes, assertNodeType} from './node_assert';
3737
import {appendChild, appendProjectedNode, createTextNode, getLViewChild, insertView, removeView} from './node_manipulation';
3838
import {isNodeMatchingSelectorList, matchingSelectorIndex} from './node_selector_matcher';
39-
import {decreaseElementDepthCount, enterView, getBindingsEnabled, getCheckNoChangesMode, getContextLView, getCurrentDirectiveDef, getCurrentViewQueryIndex, getElementDepthCount, getFirstTemplatePass, getIsParent, getLView, getPreviousOrParentTNode, increaseElementDepthCount, isCreationMode, leaveView, nextContextImpl, resetComponentState, setBindingRoot, setCheckNoChangesMode, setCurrentDirectiveDef, setCurrentViewQueryIndex, setFirstTemplatePass, setIsParent, setPreviousOrParentTNode} from './state';
39+
import {decreaseElementDepthCount, enterView, getBindingsEnabled, getCheckNoChangesMode, getContextLView, getCurrentDirectiveDef, getCurrentQueryIndex, getElementDepthCount, getFirstTemplatePass, getIsParent, getLView, getPreviousOrParentTNode, increaseElementDepthCount, isCreationMode, leaveView, nextContextImpl, resetComponentState, setBindingRoot, setCheckNoChangesMode, setCurrentDirectiveDef, setCurrentQueryIndex, setFirstTemplatePass, setIsParent, setPreviousOrParentTNode} from './state';
4040
import {getInitialClassNameValue, initializeStaticContext as initializeStaticStylingContext, patchContextWithStaticAttrs, renderInitialStylesAndClasses, renderStyling, updateClassProp as updateElementClassProp, updateContextWithBindings, updateStyleProp as updateElementStyleProp, updateStylingMap} from './styling/class_and_style_bindings';
4141
import {BoundPlayerFactory} from './styling/player_factory';
4242
import {createEmptyStylingContext, getStylingContext, hasClassInput, hasStyling, isAnimationProp} from './styling/util';
@@ -137,12 +137,11 @@ export function setHostBindings(tView: TView, viewData: LView): void {
137137
/** Refreshes content queries for all directives in the given view. */
138138
function refreshContentQueries(tView: TView): void {
139139
if (tView.contentQueries != null) {
140-
for (let i = 0; i < tView.contentQueries.length; i += 2) {
140+
setCurrentQueryIndex(0);
141+
for (let i = 0; i < tView.contentQueries.length; i++) {
141142
const directiveDefIdx = tView.contentQueries[i];
142143
const directiveDef = tView.data[directiveDefIdx] as DirectiveDef<any>;
143-
144-
directiveDef.contentQueriesRefresh !(
145-
directiveDefIdx - HEADER_OFFSET, tView.contentQueries[i + 1]);
144+
directiveDef.contentQueriesRefresh !(directiveDefIdx - HEADER_OFFSET);
146145
}
147146
}
148147
}
@@ -2762,7 +2761,7 @@ export function checkView<T>(hostView: LView, component: T) {
27622761
function executeViewQueryFn<T>(lView: LView, tView: TView, component: T): void {
27632762
const viewQuery = tView.viewQuery;
27642763
if (viewQuery) {
2765-
setCurrentViewQueryIndex(tView.viewQueryStartIndex);
2764+
setCurrentQueryIndex(tView.viewQueryStartIndex);
27662765
viewQuery(getRenderFlags(lView), component);
27672766
}
27682767
}
@@ -3111,16 +3110,6 @@ export function reference<T>(index: number) {
31113110
return loadInternal<T>(contextLView, index);
31123111
}
31133112

3114-
export function loadQueryList<T>(queryListIdx: number): QueryList<T> {
3115-
const lView = getLView();
3116-
ngDevMode &&
3117-
assertDefined(
3118-
lView[CONTENT_QUERIES], 'Content QueryList array should be defined if reading a query.');
3119-
ngDevMode && assertDataInRange(lView[CONTENT_QUERIES] !, queryListIdx);
3120-
3121-
return lView[CONTENT_QUERIES] ![queryListIdx];
3122-
}
3123-
31243113
/** Retrieves a value from current `viewData`. */
31253114
export function load<T>(index: number): T {
31263115
return loadInternal<T>(getLView(), index);
@@ -3170,26 +3159,6 @@ export function injectAttribute(attrNameToInject: string): string|null {
31703159
return injectAttributeImpl(getPreviousOrParentTNode(), attrNameToInject);
31713160
}
31723161

3173-
/**
3174-
* Registers a QueryList, associated with a content query, for later refresh (part of a view
3175-
* refresh).
3176-
*/
3177-
export function registerContentQuery<Q>(
3178-
queryList: QueryList<Q>, currentDirectiveIndex: number): void {
3179-
const viewData = getLView();
3180-
const tView = viewData[TVIEW];
3181-
const savedContentQueriesLength =
3182-
(viewData[CONTENT_QUERIES] || (viewData[CONTENT_QUERIES] = [])).push(queryList);
3183-
if (getFirstTemplatePass()) {
3184-
const tViewContentQueries = tView.contentQueries || (tView.contentQueries = []);
3185-
const lastSavedDirectiveIndex =
3186-
tView.contentQueries.length ? tView.contentQueries[tView.contentQueries.length - 2] : -1;
3187-
if (currentDirectiveIndex !== lastSavedDirectiveIndex) {
3188-
tViewContentQueries.push(currentDirectiveIndex, savedContentQueriesLength - 1);
3189-
}
3190-
}
3191-
}
3192-
31933162
export const CLEAN_PROMISE = _CLEAN_PROMISE;
31943163

31953164
function initializeTNodeInputs(tNode: TNode | null): PropertyAliases|null {

0 commit comments

Comments
 (0)