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(platform-server): remove renderApplication overload that accepts a component #49463

Closed

Conversation

alan-agius4
Copy link
Contributor

This commit removes the renderApplication overload that accepts a root component as the first parameter.

BREAKING CHANGE:

renderApplication method no longer accepts a root component as first argument. Instead, provide a bootstrapping function that returns a Promise<ApplicationRef>.

Before

const output: string = await renderApplication(RootComponent, options);

Now

const bootstrap = () => bootstrapApplication(RootComponent, appConfig);
const output: string = await renderApplication(bootstrap, options);

@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer area: server Issues related to server-side rendering target: major This PR is targeted for the next major release labels Mar 17, 2023
@ngbot ngbot bot modified the milestone: Backlog Mar 17, 2023
@angular-robot angular-robot bot added the detected: breaking change PR contains a commit with a breaking change label Mar 17, 2023
@alan-agius4 alan-agius4 requested review from jessicajaniuk and removed request for pkozlowski-opensource March 17, 2023 14:06
Copy link
Contributor

@jessicajaniuk jessicajaniuk left a comment

Choose a reason for hiding this comment

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

LGTM!

reviewed-for: fw-core, fw-platform-server, public-api

@pullapprove pullapprove bot requested review from alxhub and dylhunn March 17, 2023 17:01
@alan-agius4 alan-agius4 removed the request for review from AndrewKushnir March 17, 2023 17:12
@pullapprove pullapprove bot requested a review from atscott March 17, 2023 17:12
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.

reviewed-for: public-api

@alan-agius4 alan-agius4 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 Mar 17, 2023
@alan-agius4 alan-agius4 requested review from jessicajaniuk and removed request for alxhub, dylhunn and jessicajaniuk March 17, 2023 18:30
@JeanMeche
Copy link
Member

nit: remove the entry in deprecations.md.

@alan-agius4
Copy link
Contributor Author

@JeanMeche, this API was never deprecated as it was in developer preview.

function isBootstrapFn(value: unknown): value is() => Promise<ApplicationRef> {
// We can differentiate between a component and a bootstrap function by reading `cmp`:
return typeof value === 'function' && !getComponentDef(value);
return _render(platform, bootstrap());
Copy link
Contributor

Choose a reason for hiding this comment

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

It's amazing how simple the renderApplication function became 🎉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed 😀

@alan-agius4 alan-agius4 added the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Mar 21, 2023
@alan-agius4 alan-agius4 added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Mar 21, 2023
…ccepts a component

This commit removes the `renderApplication` overload that accepts a root component as the first parameter.

BREAKING CHANGE:

`renderApplication` method no longer accepts a root component as first argument. Instead, provide a bootstrapping function that returns a `Promise<ApplicationRef>`.

Before
```ts
const output: string = await renderApplication(RootComponent, options);
```

Now
```ts
const bootstrap = () => bootstrapApplication(RootComponent, appConfig);
const output: string = await renderApplication(bootstrap, options);
```
@alan-agius4 alan-agius4 removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Mar 22, 2023
@pkozlowski-opensource
Copy link
Member

This PR was merged into the repository by commit 41f27ad.

@alan-agius4 alan-agius4 deleted the remove-render-app-overload branch March 22, 2023 16:35
@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 Apr 22, 2023
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 area: server Issues related to server-side rendering detected: breaking change PR contains a commit with a breaking change 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

6 participants