fix(ivy): ensure parent/sub-class components evaluate styling correctly#29602
fix(ivy): ensure parent/sub-class components evaluate styling correctly#29602matsko wants to merge 3 commits intoangular:masterfrom
Conversation
d02327b to
54dce63
Compare
There was a problem hiding this comment.
I think increment/decrement be in try-finally?
There was a problem hiding this comment.
Should incrementActiveHostDirectiveInheritanceDepth we merge incrementActiveHostDirectiveIndex since they are always called together?
There was a problem hiding this comment.
| // since there can only one hostBindings function per root | |
| // since there can only be one hostBindings function per root |
packages/core/src/render3/state.ts
Outdated
There was a problem hiding this comment.
Is activeHostContext needed? Seems like a left over from previous iteration.
packages/core/src/render3/state.ts
Outdated
There was a problem hiding this comment.
if we reset depth to 0 here is decrementActiveHostDirectiveIndex method even needed?
packages/core/src/render3/state.ts
Outdated
There was a problem hiding this comment.
Do we need bothactiveHostDirectiveIndex and activeHostDirectiveInheritanceDepth they seem redundant.
Also I don't think activeHostDirectiveIndex is the right name. You are saying index which means it is index into something but than you just increment it. So it is more like uniqueId than on index?
There was a problem hiding this comment.
| * A queue of all hostStyling* instructions. | |
| * A queue of all hostStyling instructions. |
There was a problem hiding this comment.
Probably add a comment that the queue is only used for the host?
There was a problem hiding this comment.
| * a queue is contructed and then flushed once the styles are applied to | |
| * a queue is constructed and then flushed once the styles are applied to |
There was a problem hiding this comment.
| * at a later point (instead of immediately such as how templater-level styling | |
| * at a later point (instead of immediately such as how template-level styling |
There was a problem hiding this comment.
| * directives, are evluated at different points (depending on priority) and will therefore | |
| * directives, are evaluated at different points (depending on priority) and will therefore |
There was a problem hiding this comment.
| * Iterates throught the host instructions queue (if present within the provided | |
| * Iterates through the host instructions queue (if present within the provided |
5f8544e to
3293eb8
Compare
pkozlowski-opensource
left a comment
There was a problem hiding this comment.
@matsko I've left some comments (mostly about tests) that I would love to see addressed before this PR gets in (mostly nits so I hope it won't be too much trouble...). Thnx!
5f91e95 to
5051180
Compare
The new styling algorithm in angular is designed to evaluate host bindings stylinh priority in order of directive evaluation order. This, however, does not work with respect to parent/sub-class directives because sub-class host bindings are run after the parent host bindings but still have priority. This patch ensures that the host styling bindings for parent and sub-class components/directives are executed with respect to the styling algorithm prioritization. Jira Issue: FW-1132
|
|
||
| let activeDirectiveId = MIN_DIRECTIVE_ID; | ||
| let activeDirectiveSuperClassDepthPosition = 0; | ||
| let activeDirectiveSuperClassHeight = 0; |
There was a problem hiding this comment.
As far as I can tell, this global has no docs. It's not clear to me why it's necessary (in addition to the depth). Can you add docs that explain why it's necessary?
| const directiveIndex = getDirectiveIndexFromRegistry(context, directiveRef || null); | ||
|
|
||
| directiveIndex: number = 0): void { | ||
| assertValidDirectiveIndex(context, directiveIndex); |
There was a problem hiding this comment.
Seems like this should be an ngDevMode assert so it tree-shakes.
| directiveRef: any, forceOverride?: boolean): void { | ||
| const directiveIndex = getDirectiveIndexFromRegistry(context, directiveRef || null); | ||
| directiveIndex: number, forceOverride?: boolean): void { | ||
| assertValidDirectiveIndex(context, directiveIndex); |
There was a problem hiding this comment.
Needs devmode guard so it tree-shakes
50efa4e to
a5155ab
Compare
kara
left a comment
There was a problem hiding this comment.
You'll probably need to re-run the symbol test now that assertValidDirectiveIndex should be tree shaken
packages/core/src/render3/state.ts
Outdated
There was a problem hiding this comment.
| * Total count of how many directives are apart of an inheritance chain. | |
| * Total count of how many directives are a part of an inheritance chain. |
packages/core/src/render3/state.ts
Outdated
There was a problem hiding this comment.
| * needs to keep track exactly how many were encountered so it can accurately | |
| * needs to keep track of exactly how many were encountered so it can accurately |
…ly (angular#29602) The new styling algorithm in angular is designed to evaluate host bindings stylinh priority in order of directive evaluation order. This, however, does not work with respect to parent/sub-class directives because sub-class host bindings are run after the parent host bindings but still have priority. This patch ensures that the host styling bindings for parent and sub-class components/directives are executed with respect to the styling algorithm prioritization. Jira Issue: FW-1132 PR Close angular#29602
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The new styling algorithm in angular is designed to evaluate host
bindings stylinh priority in order of directive evaluation order. This,
however, does not work with respect to parent/sub-class directives
because sub-class host bindings are run after the parent host bindings
but still have priority. This patch ensures that the host styling bindings
for parent and sub-class components/directives are executed with respect
to the styling algorithm prioritization.
Jira Issue: FW-1132