-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Fix build being called before element is ready to build. #4426
Conversation
@@ -932,7 +941,7 @@ export class Resources { | |||
for (let i = 0; i < this.resources_.length; i++) { | |||
const r = this.resources_[i]; |
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.
could you rename r
to resource
? It would have made code search easier :-).
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.
Filed an issue to track some refactoring here: #4450 - don't wanna get this PR too complicated - wanna check it in for the upcoming canary.
LGTM defer to @dvoytenko for the approval |
if (this.isRuntimeOn_) { | ||
if (element.isBuilt()) { |
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.
Move to the very top.
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.
One thing, however. You are loosing schedulePass
on add
in this case. Intended? Is there a reason why you wanted to change the old behavior?
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.
You meant on upgraded
not add
, right?
I was thinking the schedulePass
inside this new function would take care of that, but I guess it's not the same, putting it back in upgraded call.
Is there harm from always scheduling a pass at the end of buildOrScheduleBuildForElement_
but inside the if(isRuntimeOn)
check instead?
* Builds the element if ready to be built, otherwise adds it to pending resources. | ||
* @private | ||
*/ | ||
buildOrScheduleBuildForElement_(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.
Let's switch and pass resource
to this method. And please add jsdoc for it.
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.
Done
LGTM pending tests. |
Fixes #4397