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

refactor(ivy): insert embedded views immediately #24629

Closed
wants to merge 2 commits into from

Conversation

marclaval
Copy link
Contributor

This PR is a follow up of #24346 where @mhevery noted that the insertion of embedded views was currently always delayed, while in fact they can be inserted immediately in most cases.

The root change here is that the canInsertNativeNode() method now returns true for views. It assumes that their parent container is already defined and inserted.
The rest of the changes is some refactoring to adapt to the new logic.

Performance wise, it doesn't improve our current benchmarks, but it slightly increases the size of the default bundles (minified hello_world goes from 8kb to 8.2kb).

@marclaval marclaval added action: review The PR is still awaiting reviews from at least one requested reviewer target: major This PR is targeted for the next major release comp: ivy labels Jun 22, 2018
@mary-poppins
Copy link

You can preview bca5208 at https://pr24629-bca5208.ngbuilds.io/.

@mhevery mhevery self-assigned this Jun 22, 2018
*
* @param parent The parent in which to insert the child
* @param currentView The LView being processed
* @return boolean Whether the child element should be inserted.
*/
export function canInsertNativeNode(parent: LNode, currentView: LViewData): boolean {
const parentIsElement = parent.tNode.type === TNodeType.Element;
const parentIsView = parent.tNode.type === TNodeType.View;
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not convinced that this logic is correct. My understanding is that we can insert view immediately if it is normal view, but always delay it if it is embedded view.

  • normal view: A view as a result of a child component view or % if() { block. (only exception is if it is projected node)
  • embedded view: A view created through ViewContainerRef

Could we VC on this?

Choose a reason for hiding this comment

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

but always delay it if it is embedded view

My understanding is there are 2 cases for embedded views:

So IMO there are cases where could insert embedded view at its creation time. Obviously it doesn't mean that we should if there is no perf gain and having 2 code paths makes the code more complex...

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@mhevery mhevery added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jun 22, 2018
@ngbot
Copy link

ngbot bot commented Jun 22, 2018

I see that you just added the PR action: merge label, but the following checks are still failing:
    failure missing required label: "cla: yes"
    failure forbidden label detected: cla: no
    failure status "cla/google" is failing
    pending status "ci/circleci: test_ivy_aot" is pending
    pending status "ci/circleci: build-packages-dist" is pending
    pending status "ci/circleci: test" is pending
    pending status "ci/circleci: test_ivy_jit" is pending
    pending status "ci/circleci: lint" is pending
    pending status "google3" is pending
    pending status "continuous-integration/travis-ci/pr" is pending

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@mhevery mhevery added cla: yes and removed cla: no labels Jun 22, 2018
@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

@mhevery
Copy link
Contributor

mhevery commented Jun 22, 2018

@mary-poppins
Copy link

You can preview 86464d6 at https://pr24629-86464d6.ngbuilds.io/.

@mhevery mhevery closed this in f229449 Jun 25, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants