Skip to content
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

Merged
merged 4 commits into from
Aug 10, 2016

Conversation

mkhatib
Copy link
Contributor

@mkhatib mkhatib commented Aug 9, 2016

Fixes #4397

@mkhatib
Copy link
Contributor Author

mkhatib commented Aug 9, 2016

I was able to test with and without this fix on @lannka patch #4399 and was unable to reproduce the issue with this fix in place.

@@ -932,7 +941,7 @@ export class Resources {
for (let i = 0; i < this.resources_.length; i++) {
const r = this.resources_[i];
Copy link
Contributor

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 :-).

Copy link
Contributor Author

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.

@lannka
Copy link
Contributor

lannka commented Aug 9, 2016

LGTM defer to @dvoytenko for the approval

if (this.isRuntimeOn_) {
if (element.isBuilt()) {
Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@dvoytenko
Copy link
Contributor

LGTM pending tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants