Visitar URL original
fix(http): Run fetch request outside the angular zone by JeanMeche · Pull Request #50981 · angular/angular · GitHub
The Wayback Machine - https://web.archive.org/web/20230726115418/https://github.com/angular/angular/pull/50981
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

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

Closed
wants to merge 1 commit into from

Conversation

JeanMeche
Copy link
Contributor

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

packages/common/http/src/fetch.ts Show resolved Hide resolved
packages/common/http/src/fetch.ts Show resolved Hide resolved
@AndrewKushnir AndrewKushnir added action: review The PR is still awaiting reviews from at least one requested reviewer area: common/http 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
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.

packages/common/http/src/fetch.ts Show resolved Hide resolved
@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
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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: common/http 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