New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(ivy): remove TStylingContext locking in favor of firstUpdatePass flag #33521
Conversation
695a0b2
to
a2527ec
Compare
a2527ec
to
7c18290
Compare
@@ -93,8 +92,8 @@ export function allowDirectStyling(context: TStylingContext, hostBindingsMode: b | |||
// `ngDevMode` is required to be checked here because tests/debugging rely on the context being | |||
// populated. If things are in production mode then there is no need to build a context | |||
// therefore the direct apply can be allowed (even on the first update). | |||
allow = ngDevMode ? contextIsLocked : true; | |||
} else if (contextIsLocked) { | |||
allow = ngDevMode ? !firstUpdatePass : true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line and comment looks suspicious. It seems to me that we are changing runtime behavior depending on the ngDevMode
? That does not seem right to me. Can you better explain to me what is going on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not need to populate a context whilst in prod mode. The only only reason we do this is in devMode is so that debugNode.styles.debug
and debugNode.classes.debug
can properly list out all classes/styles on the element (otherwise it doesn't know because the direct styling apply mode doesn't keep track of anything).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this not imply that we could accidentally rely on that information in ngDevMode
??? I think it would be better if we did not have such code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix for this is to design a debugging layer that works independent of the underling style/class application algorithms.
* provided `TStylingContext` (which is an instance of a `StylingMapArray`). This inner map will | ||
* be updated each time a host binding applies its static styling values (via `elementHostAttrs`) | ||
* so these values are only read at this point because this is the very last point before the | ||
* first style/class values are flushed to the element. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above is confusing. Could we have a small code snippet / Concrete example showing why this is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
7c18290
to
53ecac9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments
03f6b01
to
1a51126
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take care of @kara comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
1a51126
to
6f78c1c
Compare
…Pass flag This patch removes the need to lock the style and class context instances to track when bindings can be added. What happens now is that the `tNode.firstUpdatePass` is used to track when bindings are registered on the context instances.
6f78c1c
to
9be823a
Compare
…Pass flag (angular#33521) This patch removes the need to lock the style and class context instances to track when bindings can be added. What happens now is that the `tNode.firstUpdatePass` is used to track when bindings are registered on the context instances. PR Close angular#33521
…Pass flag (angular#33521) This patch removes the need to lock the style and class context instances to track when bindings can be added. What happens now is that the `tNode.firstUpdatePass` is used to track when bindings are registered on the context instances. PR Close angular#33521
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. |
This patch removes the need to lock the style and class context
instances to track when bindings can be added. What happens now is
that the
tNode.firstUpdatePass
is used to track when bindings areregistered on the context instances.