angular/integration/platform-server/e2e
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
..
helloworld-spec.ts fix(platform-browser): only add ng-app-id to style on server side (#49465) 2023-03-17 17:26:27 +01:00
http-transferstate-lazy-spec.ts fix(http): force macro task creation during HTTP request (#49546) 2023-03-29 09:13:41 -07:00
protractor.config.js test: switch integration tests from puppeteer/webdriver-manager to Bazel-managed chromium (#44238) 2021-12-08 13:42:42 -05:00
transferstate-spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
tsconfig.json refactor(dev-infra): remove obsolete todos (#49362) 2023-03-08 15:39:55 -08:00
util.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00