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 area: core Issues related to the framework runtime 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 July 8, 2022 01:45
@AndrewKushnir AndrewKushnir added action: review The PR is still awaiting reviews from at least one requested reviewer and removed state: WIP labels Jul 8, 2022
@AndrewKushnir AndrewKushnir requested review from alxhub, pkozlowski-opensource and atscott and removed request for alxhub July 8, 2022 01:49
@AndrewKushnir AndrewKushnir marked this pull request as ready for review July 8, 2022 01:49
@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

@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 July 8, 2022 06:27
Copy link
Member

@pkozlowski-opensource pkozlowski-opensource left a comment

Choose a reason for hiding this comment

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

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

Copy link
Contributor

@atscott atscott left a comment

Choose a reason for hiding this comment

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

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 July 13, 2022 18:28
@AndrewKushnir AndrewKushnir removed the action: review The PR is still awaiting reviews from at least one requested reviewer label 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

@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.

@mary-poppins
Copy link

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

@AndrewKushnir
Copy link
Contributor Author

Presubmit #2.

Copy link
Member

@alxhub alxhub left a comment

Choose a reason for hiding this comment

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

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 The PR is ready for merge by the caretaker and removed action: presubmit The PR is in need of a google3 presubmit labels Jul 14, 2022
@mary-poppins
Copy link

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

@jessicajaniuk
Copy link
Contributor

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

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 The PR is ready for merge by the caretaker aio: preview area: core Issues related to the framework runtime 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