Skip to content

fix(http): Run fetch request outside the angular zone#50981

Closed
JeanMeche wants to merge 1 commit intoangular:mainfrom
JeanMeche:fix/http-zone
Closed

fix(http): Run fetch request outside the angular zone#50981
JeanMeche wants to merge 1 commit intoangular:mainfrom
JeanMeche:fix/http-zone

Conversation

@JeanMeche
Copy link
Copy Markdown
Member

@JeanMeche JeanMeche commented Jul 9, 2023

Having the request run in the angular zone has the consequence of triggering the CD for every read of the response stream.

This commit wraps the whole doRequest to run outside angular with every callback on the observer being called inside the zone.

Fixes #50979.

PR Type

What kind of change does this PR introduce?

  • Bugfix

Does this PR introduce a breaking change?

  • No

@JeanMeche JeanMeche force-pushed the fix/http-zone branch 3 times, most recently from 9f5b270 to 63d1537 Compare July 9, 2023 22:07
@JeanMeche JeanMeche marked this pull request as ready for review July 9, 2023 22:19
@JeanMeche JeanMeche changed the title fix(http): Run fetch request out the angular zone fix(http): Run fetch request outside the angular zone Jul 9, 2023
Copy link
Copy Markdown
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.

@JeanMeche thanks for the fix 👍

@AndrewKushnir AndrewKushnir added action: review The PR is still awaiting reviews from at least one requested reviewer area: common/http Issues related to HTTP and HTTP Client target: patch This PR is targeted for the next patch release labels Jul 11, 2023
@ngbot ngbot bot added this to the Backlog milestone Jul 11, 2023
@JeanMeche JeanMeche force-pushed the fix/http-zone branch 2 times, most recently from a13b479 to b9994b3 Compare July 14, 2023 22:16
Copy link
Copy Markdown
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.

@JeanMeche looks great, just a quick note to add a comment to document the context. Thank you.

@AndrewKushnir AndrewKushnir added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews action: presubmit The PR is in need of a google3 presubmit and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jul 14, 2023
Having the request run in the angular zone has the consequence of triggering the CD for every read of the response stream.

This commit wraps the whole `doRequest` to run outside angular with every callback on the observer being called inside the zone.

Fixes angular#50979.
@AndrewKushnir
Copy link
Copy Markdown
Contributor

Presubmit.

@AndrewKushnir AndrewKushnir 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 Jul 14, 2023
@AndrewKushnir AndrewKushnir removed the request for review from pkozlowski-opensource July 14, 2023 23:14
@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 15, 2023
@jessicajaniuk
Copy link
Copy Markdown
Contributor

This PR was merged into the repository by commit c5608e5.

jessicajaniuk pushed a commit that referenced this pull request Jul 17, 2023
Having the request run in the angular zone has the consequence of triggering the CD for every read of the response stream.

This commit wraps the whole `doRequest` to run outside angular with every callback on the observer being called inside the zone.

Fixes #50979.

PR Close #50981
NoelLH added a commit to thebiggive/donate-frontend that referenced this pull request Jul 20, 2023
Includes an Angular 16 minor version update
fixing an HTTP change detection thing which
might impact our resolvers / some page loads' handovers

angular/angular#50981
sunilbaba pushed a commit to sunilbaba/angular that referenced this pull request Jul 26, 2023
Having the request run in the angular zone has the consequence of triggering the CD for every read of the response stream.

This commit wraps the whole `doRequest` to run outside angular with every callback on the observer being called inside the zone.

Fixes angular#50979.

PR Close angular#50981
@JeanMeche JeanMeche deleted the fix/http-zone branch August 3, 2023 13:37
@angular-automatic-lock-bot
Copy link
Copy Markdown

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 3, 2023
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this pull request Jan 23, 2024
Having the request run in the angular zone has the consequence of triggering the CD for every read of the response stream.

This commit wraps the whole `doRequest` to run outside angular with every callback on the observer being called inside the zone.

Fixes angular#50979.

PR Close angular#50981
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 target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HttpClient with fetch backend triggers too much change detection

6 participants