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(ivy): allow root components to inject ViewContainerRef #26682

Conversation

pkozlowski-opensource
Copy link
Member

This PR introduces introduces ability to inject ViewContainerRef on the root / topmost / bootstrapped component. This is supported in the current view engine and used in some tests (ex.:

constructor(private _viewContainerRef: ViewContainerRef) {}
).

In case of ViewContainerRef injected on the topmost component we need to do low-level DOM manipulation to find parent of the host node (to insert a comment node) and a sibling of the host node (to place a comment node next to it). Since both the comment node and its parent will be outside of LTree we need to resort to DOM manipulation.

I'm not super-happy about this change and open to discussing alternatives (where alternative could be simply banning ability to inject ViewContainerRef into the topmost component).

@pkozlowski-opensource pkozlowski-opensource 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 Oct 23, 2018
@ngbot ngbot bot added this to the needsTriage milestone Oct 23, 2018
@mary-poppins
Copy link

You can preview e4743d9 at https://pr26682-e4743d9.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 84d3062 at https://pr26682-84d3062.ngbuilds.io/.

@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 all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

@@ -94,11 +97,15 @@ export interface RendererFactory3 {

export const domRendererFactory3: RendererFactory3 = {
createRenderer: (hostElement: RElement | null, rendererType: RendererType2 | null):
Renderer3 => { return document;}
Renderer3 => { return document as ObjectOrientedRenderer3;}
Copy link
Contributor

Choose a reason for hiding this comment

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

The fact that you have to cast tells me that our ObjectOrientedRenderer3 does not match document

* views into.
*/
[RENDER_PARENT]: RElement|null;
[RENDER_PARENT]: RNode|null;
Copy link
Contributor

Choose a reason for hiding this comment

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

How can parent be something other than RElement?

@@ -68,9 +68,12 @@ export interface ProceduralRenderer3 {
destroyNode?: ((node: RNode) => void)|null;
appendChild(parent: RElement, newChild: RNode): void;
insertBefore(parent: RNode, newChild: RNode, refChild: RNode|null): void;
removeChild(parent: RElement, oldChild: RNode): void;
removeChild(parent: RNode, oldChild: RNode): void;
Copy link
Contributor

Choose a reason for hiding this comment

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

How can you remove from something other than RElement?

@mhevery mhevery added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews cla: yes and removed cla: no labels Oct 23, 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.)

@mary-poppins
Copy link

You can preview 3e3a61e at https://pr26682-3e3a61e.ngbuilds.io/.

@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 all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

@pkozlowski-opensource pkozlowski-opensource removed the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 24, 2018
@googlebot
Copy link

CLAs look good, thanks!

@mary-poppins
Copy link

You can preview 6b28813 at https://pr26682-6b28813.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 079664f at https://pr26682-079664f.ngbuilds.io/.

@mary-poppins
Copy link

You can preview a4d433b at https://pr26682-a4d433b.ngbuilds.io/.

@mary-poppins
Copy link

You can preview c70da1e at https://pr26682-c70da1e.ngbuilds.io/.

@mhevery
Copy link
Contributor

mhevery commented Oct 25, 2018

@mary-poppins
Copy link

You can preview 31fc453 at https://pr26682-31fc453.ngbuilds.io/.

@pkozlowski-opensource pkozlowski-opensource added the action: merge The PR is ready for merge by the caretaker label Oct 26, 2018
@ngbot
Copy link

ngbot bot commented Oct 26, 2018

I see that you just added the PR action: merge label, but the following checks are still failing:
    failure status "ci/circleci: test_docs_examples_0" is failing
    pending status "google3" 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.

@pkozlowski-opensource
Copy link
Member Author

Marking as merge-assistance since:

  • ci/circleci: test_docs_examples_0 is failing for unrelated reasons
  • google3 pre-submit is pending and I've got no control over it

@pkozlowski-opensource pkozlowski-opensource force-pushed the ivy_vcref_on_root_component branch 3 times, most recently from 205dba9 to 7cd961d Compare October 29, 2018 09:18
@mary-poppins
Copy link

You can preview 7cd961d at https://pr26682-7cd961d.ngbuilds.io/.

@pkozlowski-opensource pkozlowski-opensource force-pushed the ivy_vcref_on_root_component branch 3 times, most recently from 89223b0 to c448a09 Compare October 29, 2018 09:34
@mary-poppins
Copy link

You can preview c448a09 at https://pr26682-c448a09.ngbuilds.io/.

@pkozlowski-opensource pkozlowski-opensource force-pushed the ivy_vcref_on_root_component branch 2 times, most recently from cc6981f to 8e5374c Compare October 29, 2018 09:58
@mary-poppins
Copy link

You can preview 8e5374c at https://pr26682-8e5374c.ngbuilds.io/.

@pkozlowski-opensource
Copy link
Member Author

merge-assistance since g3presubmit is needed.

@kara
Copy link
Contributor

kara commented Oct 29, 2018

presubmit

@kara kara removed the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Oct 29, 2018
@matsko matsko closed this in ede65db Oct 29, 2018
sculove pushed a commit to sculove/angular that referenced this pull request Nov 2, 2018
FrederikSchlemmer pushed a commit to FrederikSchlemmer/angular that referenced this pull request Jan 3, 2019
@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 14, 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