Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(core): update ApplicationRef.isStable to account for rendering pending tasks #50425

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

Closed
wants to merge 4 commits into from

Conversation

alan-agius4
Copy link
Contributor

@alan-agius4 alan-agius4 commented May 23, 2023

fix(core): update ApplicationRef.isStable to account for rendering pending tasks

This commit updates the ApplicationRef.isStable API to account for pending rendering task. This is needed as once a pending rendering task is done, new macrotask and microtask could be created which previously caused these not to be intercepted and thus ignored when doing SSR.

refactor(http): replace zone.js macrotask creation with InitialRenderPendingTasks

This commits refactors the HTTP client to use InitialRenderPendingTasks instead of Zone.js macrotask. This is another approach to #50406 which was revert due to a failure in G3.

@alan-agius4 alan-agius4 self-assigned this May 23, 2023
@alan-agius4 alan-agius4 added area: core Issues related to the framework runtime area: server Issues related to server-side rendering target: patch This PR is targeted for the next patch release core: hydration labels May 25, 2023
@ngbot ngbot bot modified the milestone: Backlog May 25, 2023
@alan-agius4 alan-agius4 added the area: common/http Issues related to HTTP and HTTP Client label May 25, 2023
@alan-agius4 alan-agius4 removed the area: common/http Issues related to HTTP and HTTP Client label May 25, 2023
@alan-agius4 alan-agius4 marked this pull request as ready for review May 25, 2023 12:12
@pullapprove pullapprove bot requested review from crisbeto and dylhunn May 25, 2023 12:12
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label May 25, 2023
@alan-agius4 alan-agius4 requested review from AndrewKushnir and removed request for crisbeto May 25, 2023 12:13
AndrewKushnir
AndrewKushnir previously approved these changes May 26, 2023
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@alan-agius4 my original thinking was that we wanted to do the inverse though: use the InitialRenderPendingTasks as the main instance that controls the state and make ApplicationRef.isStable contribute to it. However, in this case the InitialRenderPendingTasks needs to be an observable too. Let's ship the fix as is and come back to this discussion later (as a part of zoneless support for SSR).

@AndrewKushnir AndrewKushnir removed the action: review The PR is still awaiting reviews from at least one requested reviewer label May 26, 2023
@alan-agius4 alan-agius4 removed the request for review from dylhunn May 26, 2023 04:15
…pending tasks

This commit updates the `ApplicationRef.isStable` API to account for
pending rendering task. This is needed as once a pending rendering task
is done, new macrotask and microtask could be created which previously caused these not
to be intercepted and thus ignored when doing SSR.
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label May 26, 2023
@alan-agius4 alan-agius4 requested a review from AndrewKushnir May 26, 2023 12:02
@pullapprove pullapprove bot requested review from AndrewKushnir and dylhunn May 27, 2023 11:58
@alan-agius4
Copy link
Contributor Author

Caretaker note: G3 failures are pre-existing.

@alan-agius4 alan-agius4 added merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed action: global presubmit The PR is in need of a google3 global presubmit labels May 27, 2023
Copy link
Contributor

@AndrewKushnir AndrewKushnir 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: size-tracking

@AndrewKushnir AndrewKushnir removed the action: review The PR is still awaiting reviews from at least one requested reviewer label May 27, 2023
@AndrewKushnir
Copy link
Contributor

@alan-agius4 I've LGTM'ed for size-tracking, is it ready for merge?

@alan-agius4 alan-agius4 removed the request for review from dylhunn May 27, 2023 18:53
@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label May 27, 2023
@alan-agius4
Copy link
Contributor Author

Yes @AndrewKushnir

@alan-agius4 alan-agius4 added the area: common/http Issues related to HTTP and HTTP Client label May 27, 2023
@dylhunn
Copy link
Contributor

dylhunn commented May 30, 2023

This PR was merged into the repository by commit 0c80349.

dylhunn pushed a commit that referenced this pull request May 30, 2023
…pending tasks (#50425)

This commit updates the `ApplicationRef.isStable` API to account for
pending rendering task. This is needed as once a pending rendering task
is done, new macrotask and microtask could be created which previously caused these not
to be intercepted and thus ignored when doing SSR.

PR Close #50425
dylhunn pushed a commit that referenced this pull request May 30, 2023
…rPendingTasks` (#50425)

This commits refactors the HTTP client to use `InitialRenderPendingTasks` instead of Zone.js macrotask. This is another approach to #50406 which was revert due to a failure in G3.

PR Close #50425
@dylhunn dylhunn closed this in 28c68f7 May 30, 2023
dylhunn pushed a commit that referenced this pull request May 30, 2023
…rPendingTasks` (#50425)

This commits refactors the HTTP client to use `InitialRenderPendingTasks` instead of Zone.js macrotask. This is another approach to #50406 which was revert due to a failure in G3.

PR Close #50425
@alan-agius4 alan-agius4 deleted the pending-tasks branch May 30, 2023 20:00
@matthew-whitfield-uk
Copy link

From my tests, this seems to re-introduce the bug fixed originally in #50406 (issue - #50405)

The HTML rendered on the server side by angular universal doesn't wait for HTTP calls to complete before sending the HTML to the user.

Here is a minimal repo - https://github.com/matthew-whitfield-uk/transfer-state-demo

Steps:

  1. npm run dev:ssr to start universal server
  2. navigate to /test-page route
  3. view the console to see that HTTP request is not transferred to client, only a state set on initialisation is transferred

@alan-agius4
Copy link
Contributor Author

@matthew-whitfield-uk, please subscribe to #50562

crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull request Jun 6, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@angular/animations](https://github.com/angular/angular) | dependencies | patch | [`16.0.2` -> `16.0.4`](https://renovatebot.com/diffs/npm/@angular%2fanimations/16.0.2/16.0.4) |
| [@angular/common](https://github.com/angular/angular) | dependencies | patch | [`16.0.2` -> `16.0.4`](https://renovatebot.com/diffs/npm/@angular%2fcommon/16.0.2/16.0.4) |
| [@angular/compiler](https://github.com/angular/angular) | dependencies | patch | [`16.0.2` -> `16.0.4`](https://renovatebot.com/diffs/npm/@angular%2fcompiler/16.0.2/16.0.4) |
| [@angular/compiler-cli](https://github.com/angular/angular/tree/main/packages/compiler-cli) ([source](https://github.com/angular/angular)) | devDependencies | patch | [`16.0.2` -> `16.0.4`](https://renovatebot.com/diffs/npm/@angular%2fcompiler-cli/16.0.2/16.0.4) |
| [@angular/core](https://github.com/angular/angular) | dependencies | patch | [`16.0.2` -> `16.0.4`](https://renovatebot.com/diffs/npm/@angular%2fcore/16.0.2/16.0.4) |
| [@angular/forms](https://github.com/angular/angular) | dependencies | patch | [`16.0.2` -> `16.0.4`](https://renovatebot.com/diffs/npm/@angular%2fforms/16.0.2/16.0.4) |
| [@angular/platform-browser](https://github.com/angular/angular) | dependencies | patch | [`16.0.2` -> `16.0.4`](https://renovatebot.com/diffs/npm/@angular%2fplatform-browser/16.0.2/16.0.4) |
| [@angular/platform-browser-dynamic](https://github.com/angular/angular) | dependencies | patch | [`16.0.2` -> `16.0.4`](https://renovatebot.com/diffs/npm/@angular%2fplatform-browser-dynamic/16.0.2/16.0.4) |

---

### Release Notes

<details>
<summary>angular/angular</summary>

### [`v16.0.4`](https://github.com/angular/angular/blob/HEAD/CHANGELOG.md#&#8203;1604-2023-06-01)

[Compare Source](angular/angular@16.0.3...16.0.4)

##### animations

| Commit | Type | Description |
| -- | -- | -- |
| [df65c4fc8f](angular/angular@df65c4f) | fix | Trigger leave animation when ViewContainerRef is injected ([#&#8203;48705](angular/angular#48705)) |

##### common

| Commit | Type | Description |
| -- | -- | -- |
| [7e1bc513de](angular/angular@7e1bc51) | fix | untrack subscription and unsubscription in async pipe ([#&#8203;50522](angular/angular#50522)) |

##### core

| Commit | Type | Description |
| -- | -- | -- |
| [9970b29ace](angular/angular@9970b29) | fix | update `ApplicationRef.isStable` to account for rendering pending tasks ([#&#8203;50425](angular/angular#50425)) |

<!-- CHANGELOG SPLIT MARKER -->

### [`v16.0.3`](https://github.com/angular/angular/blob/HEAD/CHANGELOG.md#&#8203;1603-2023-05-24)

[Compare Source](angular/angular@16.0.2...16.0.3)

##### core

| Commit | Type | Description |
| -- | -- | -- |
| [c11041e372](angular/angular@c11041e) | fix | adds missing symbols for animation standalone bundling test ([#&#8203;50434](angular/angular#50434)) |
| [98e8fdf40e](angular/angular@98e8fdf) | fix | fix `Self` flag inside embedded views with custom injectors ([#&#8203;50270](angular/angular#50270)) |
| [199ff4fe7f](angular/angular@199ff4f) | fix | host directives incorrectly validating aliased bindings ([#&#8203;50364](angular/angular#50364)) |

##### http

| Commit | Type | Description |
| -- | -- | -- |
| [080bbd2137](angular/angular@080bbd2) | fix | create macrotask during request handling instead of load start ([#&#8203;50406](angular/angular#50406)) |

<!-- CHANGELOG SPLIT MARKER -->

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMTEuMCIsInVwZGF0ZWRJblZlciI6IjM1LjExMS4wIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCJ9-->

Co-authored-by: cabr2-bot <[email protected]>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1915
Reviewed-by: Epsilon_02 <[email protected]>
Co-authored-by: Calciumdibromid Bot <[email protected]>
Co-committed-by: Calciumdibromid Bot <[email protected]>
@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 Jul 6, 2023
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this pull request Jan 23, 2024
…pending tasks (angular#50425)

This commit updates the `ApplicationRef.isStable` API to account for
pending rendering task. This is needed as once a pending rendering task
is done, new macrotask and microtask could be created which previously caused these not
to be intercepted and thus ignored when doing SSR.

PR Close angular#50425
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this pull request Jan 23, 2024
…rPendingTasks` (angular#50425)

This commits refactors the HTTP client to use `InitialRenderPendingTasks` instead of Zone.js macrotask. This is another approach to angular#50406 which was revert due to a failure in G3.

PR Close angular#50425
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: common/http Issues related to HTTP and HTTP Client area: core Issues related to the framework runtime area: server Issues related to server-side rendering core: hydration merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants