angular/packages/common
Alan Agius 45a6ac09fd fix(http): force macro task creation during HTTP request (#49546)
This commit adds a background macrotask when an XHR request is performed. The macrotask is started during `loadstart` and ended during `loadend` event.

The macrotask is needed so that the application is not stabilized during HTTP calls. This is important for server rendering, as the application is rendering when the application is stabilized.
The application is stabilized when there are no longer pending Macro and Micro tasks intercepted by Zone.js, Since an XHR request is none of these, we create a background macrotask so that Zone.js is
made aware that there is something pending.

Prior to this change, we patched the `HttpHandler` in `@angular/platform-server` but this is not enough, as there can be multiple `HttpHandler` in an application, example when importing `HttpClient` in a lazy loaded component/module.
Which causes a new unpatched instance of `HttpHandler` to be created in the child injector which is not intercepted by Zone.js and thus the application is stabalized and rendered before the XHR request is finalized.

NB: Zone.js is fundamental for SSR and currently, it's not possible to do SSR without it.

Closes: #49425

PR Close #49546
2023-03-29 09:13:41 -07:00
..
http fix(http): force macro task creation during HTTP request (#49546) 2023-03-29 09:13:41 -07:00
locales build: make devmode a noop and ensure it never runs (#48521) 2022-12-19 19:50:45 +00:00
src fix(common): invalid ImageKit transformation (#49201) 2023-03-27 08:33:22 -07:00
test refactor(common): add missing override to satisfy the linter (#49599) 2023-03-28 10:12:36 -07:00
testing refactor(common): add missing override to satisfy the linter (#49599) 2023-03-28 10:12:36 -07:00
upgrade refactor(common): Use isPromise from @angular/core (#49210) 2023-02-27 10:03:20 -08:00
BUILD.bazel refactor: remove Angular Compatibility Compiler (ngcc) (#49101) 2023-02-16 16:01:17 -08:00
index.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
package.json refactor(core): remove Node.js v14 support (#49255) 2023-02-28 11:00:25 -08:00
PACKAGE.md docs: add api doc to sub-packages (#33801) 2019-11-20 14:48:50 -08:00
public_api.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00