angular/integration/platform-server-hydration
Alan Agius 28926ba92c feat(core): introduce BootstrapContext for improved server bootstrapping (#63562)
This commit introduces a number of changes to the server bootstrapping process to make it more robust and less error-prone, especially for concurrent requests.

Previously, the server rendering process relied on a module-level global platform injector. This could lead to issues in server-side rendering environments where multiple requests are processed concurrently, as they could inadvertently share or overwrite the global injector state.

The new approach introduces a `BootstrapContext` that is passed to the `bootstrapApplication` function. This context provides a platform reference that is scoped to the individual request, ensuring that each server-side render has an isolated platform injector. This prevents state leakage between concurrent requests and makes the overall process more reliable.

BREAKING CHANGE:
The server-side bootstrapping process has been changed to eliminate the reliance on a global platform injector.

Before:
```ts
const bootstrap = () => bootstrapApplication(AppComponent, config);
```

After:
```ts
const bootstrap = (context: BootstrapContext) =>
  bootstrapApplication(AppComponent, config, context);
```

A schematic is provided to automatically update `main.server.ts` files to pass the `BootstrapContext` to the `bootstrapApplication` call.

In addition, `getPlatform()` and `destroyPlatform()` will now return `null` and be a no-op respectively when running in a server environment.

PR Close #63562
2025-09-09 10:57:09 -07:00
..
e2e build: bump @angular/ssr to 20.2.0-rc.1 (#63176) 2025-08-15 09:44:00 +02:00
public test: add Integration tests for hydration and event reply (#55708) 2024-05-07 13:39:55 -07:00
src feat(core): introduce BootstrapContext for improved server bootstrapping (#63562) 2025-09-09 10:57:09 -07:00
.gitignore test: add Integration tests for hydration and event reply (#55708) 2024-05-07 13:39:55 -07:00
angular.json test: update protractor builder usage to private-protractor (#58254) 2024-10-22 07:37:14 -07:00
BUILD.bazel ci: use new size tracking in integration tests (#62650) 2025-07-17 13:56:22 -04:00
copy-event-dispatch-contract.mjs test: add Integration tests for hydration and event reply (#55708) 2024-05-07 13:39:55 -07:00
package.json test: use zone from npm instead of the locally built package for integration tests (#61947) 2025-06-06 15:20:11 -07:00
size.json feat(router): add a currentNavigation signal to the Router service. (#63011) 2025-08-06 09:54:53 -07:00
tsconfig.app.json test: add Integration tests for hydration and event reply (#55708) 2024-05-07 13:39:55 -07:00
tsconfig.json test: add Integration tests for hydration and event reply (#55708) 2024-05-07 13:39:55 -07:00
yarn.lock test: use zone from npm instead of the locally built package for integration tests (#61947) 2025-06-06 15:20:11 -07:00