fix(ivy): View Queries inheritance fix (#28309)
Prior to this change `viewQuery` functions that represent @ViewQuery list were not composable, which caused problems in case one Component/Directive inherits another one and both of them contain View Queries. Due to the fact that we used indices to reference queries, resulting query set was corrupted (child component queries were overridden by super class ones). In order to avoid that we no longer use indices assigned at compile time and instead maintain current view query index while iterating through them. This allows us to compose `viewQuery` functions and make inheritance feature work with View Queries. PR Close #28309
This commit is contained in:

committed by
Jason Aden

parent
9f9024b7a1
commit
9098225ff0
@ -335,6 +335,17 @@ export interface TView {
|
||||
*/
|
||||
expandoStartIndex: number;
|
||||
|
||||
/**
|
||||
* The index where the viewQueries section of `LView` begins. This section contains
|
||||
* view queries defined for a component/directive.
|
||||
*
|
||||
* We store this start index so we know where the list of view queries starts.
|
||||
* This is required when we invoke view queries at runtime. We invoke queries one by one and
|
||||
* increment query index after each iteration. This information helps us to reset index back to
|
||||
* the beginning of view query list before we invoke view queries again.
|
||||
*/
|
||||
viewQueryStartIndex: number;
|
||||
|
||||
/**
|
||||
* Index of the host node of the first LView or LContainer beneath this LView in
|
||||
* the hierarchy.
|
||||
|
Reference in New Issue
Block a user