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

feat(core): add createComponent and reflectComponentType functions #46685

Closed

Conversation

AndrewKushnir
Copy link
Contributor

@AndrewKushnir AndrewKushnir commented Jul 2, 2022

See individual commits.

Resolves #45263 and #44926.

PR Type

What kind of change does this PR introduce?

  • Feature

Does this PR introduce a breaking change?

  • Yes
  • No

@AndrewKushnir AndrewKushnir added feature Issue that requests a new feature state: WIP comp: core Runtime issues target: minor This PR is targeted for the next minor release labels Jul 2, 2022
@ngbot ngbot bot modified the milestone: Backlog Jul 2, 2022
@gund
Copy link

gund commented Jul 4, 2022

This is great replacement for component factories!
However the naming maybe a bit confusing, maybe something like ComponentMetadata would be more appropriate to capture the intent instead of a ComponentMirror as it's not really mirroring anything but providing an extra "meta" information.

@AndrewKushnir AndrewKushnir force-pushed the create-component-ref branch 2 times, most recently from 460d222 to 274f4a3 Compare Jul 8, 2022
@AndrewKushnir AndrewKushnir requested review from alxhub, pkozlowski-opensource and atscott and removed request for alxhub Jul 8, 2022
@AndrewKushnir AndrewKushnir marked this pull request as ready for review Jul 8, 2022
@AndrewKushnir AndrewKushnir changed the title feat(core): add createComponentRef and createComponentMirror functions feat(core): add createComponentRef and reflectComponentType functions Jul 8, 2022
@AndrewKushnir
Copy link
Contributor Author

AndrewKushnir commented Jul 8, 2022

@gund thanks for the feedback. We discussed this question with the team further and decided to rename the function to reflectComponentType.

@pullapprove pullapprove bot requested a review from dylhunn Jul 8, 2022
Copy link
Member

@pkozlowski-opensource pkozlowski-opensource left a comment

LGTM overall but I would like to discuss the API surface, see https://github.com/angular/angular/pull/46685/files#r916504416

atscott
atscott approved these changes Jul 8, 2022
Copy link
Contributor

@atscott atscott left a comment

LGTM assuming the change from createComponentRef -> createComponent is made, as discussed.

packages/core/src/render3/component_ref.ts Outdated Show resolved Hide resolved
@dylhunn dylhunn removed their request for review Jul 13, 2022
goldens/public-api/core/index.md Show resolved Hide resolved
packages/core/src/render3/component.ts Outdated Show resolved Hide resolved
packages/core/src/render3/component_ref.ts Show resolved Hide resolved
@AndrewKushnir
Copy link
Contributor Author

AndrewKushnir commented Jul 13, 2022

@alxhub thanks for the review, the comments are now addressed. Could you please take a final look at the public API when you get a chance? Thank you.

@AndrewKushnir AndrewKushnir requested a review from alxhub Jul 13, 2022
@mary-poppins
Copy link

mary-poppins commented Jul 13, 2022

You can preview 5a47792 at https://pr46685-5a47792.ngbuilds.io/.

@AndrewKushnir
Copy link
Contributor Author

AndrewKushnir commented Jul 13, 2022

Presubmit #2.

alxhub
alxhub approved these changes Jul 14, 2022
Copy link
Contributor

@alxhub alxhub left a comment

Reviewed-for: public-api

This commit introduces a new function that allows creating a `ComponentRef` instance based on provided Component and a set of options. The function can be used to cover a number of use-cases where the `ComponentFactory` symbol was used previously.

Closes angular#45263.
This commit introduces a new function that allows creating a object which exposes a number of getters to retrieve information about a given component.

Closes angular#44926.
This commit refactors the code to move some functions around to avoid circular dependencies in TS imports. The newly added functions are now located in the `packages/core/src/render3/component.ts` file (instead of `packages/core/src/render3/component_ref.ts`), which is a better place for them anyway.
This commit updates the `inputs` and `outputs` objects of the `ComponentMirror` to mark their properties as readonly.
@AndrewKushnir AndrewKushnir added action: merge PR author is ready for this to merge and removed action: presubmit A standard presubmit is running / required labels Jul 14, 2022
@mary-poppins
Copy link

mary-poppins commented Jul 14, 2022

You can preview cb82edc at https://pr46685-cb82edc.ngbuilds.io/.

@jessicajaniuk
Copy link
Contributor

jessicajaniuk commented Jul 14, 2022

This PR was merged into the repository by commit 4a81fe7.

jessicajaniuk pushed a commit that referenced this pull request Jul 14, 2022
This commit introduces a new function that allows creating a object which exposes a number of getters to retrieve information about a given component.

Closes #44926.

PR Close #46685
jessicajaniuk pushed a commit that referenced this pull request Jul 14, 2022
This commit refactors the code to move some functions around to avoid circular dependencies in TS imports. The newly added functions are now located in the `packages/core/src/render3/component.ts` file (instead of `packages/core/src/render3/component_ref.ts`), which is a better place for them anyway.

PR Close #46685
jessicajaniuk pushed a commit that referenced this pull request Jul 14, 2022
…46685)

This commit updates the `inputs` and `outputs` objects of the `ComponentMirror` to mark their properties as readonly.

PR Close #46685
AndrewKushnir added a commit to AndrewKushnir/angular that referenced this pull request Jul 15, 2022
This commit introduces a new function that allows creating a `ComponentRef` instance based on provided Component and a set of options. The function can be used to cover a number of use-cases where the `ComponentFactory` symbol was used previously.

Closes angular#45263.

PR Close angular#46685
AndrewKushnir added a commit to AndrewKushnir/angular that referenced this pull request Jul 15, 2022
This commit introduces a new function that allows creating a object which exposes a number of getters to retrieve information about a given component.

Closes angular#44926.

PR Close angular#46685
AndrewKushnir added a commit to AndrewKushnir/angular that referenced this pull request Jul 15, 2022
…#46685)

This commit refactors the code to move some functions around to avoid circular dependencies in TS imports. The newly added functions are now located in the `packages/core/src/render3/component.ts` file (instead of `packages/core/src/render3/component_ref.ts`), which is a better place for them anyway.

PR Close angular#46685
AndrewKushnir added a commit to AndrewKushnir/angular that referenced this pull request Jul 15, 2022
…ngular#46685)

This commit updates the `inputs` and `outputs` objects of the `ComponentMirror` to mark their properties as readonly.

PR Close angular#46685
@angular-automatic-lock-bot
Copy link

angular-automatic-lock-bot bot commented Aug 14, 2022

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 Aug 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge PR author is ready for this to merge aio: preview comp: core Runtime issues feature Issue that requests a new feature target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot create component without inserting into DOM without the deprecated ComponentFactory
8 participants