angular/packages/core/test
Alan Agius 9d1fb33f5e fix(core): introduce BootstrapContext for improved server bootstrapping (#63640)
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.

(cherry picked from commit 8bf80c9d2314b4f2bcf3df83ae01552a6fc49834)

PR Close #63640
2025-09-09 10:46:27 -07:00
..
acceptance fix(core): resolve forward-referenced host directives during directive matching (#58492) (#58500) 2024-11-04 17:18:52 +01:00
animation refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
authoring refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
bundling fix(core): introduce BootstrapContext for improved server bootstrapping (#63640) 2025-09-09 10:46:27 -07:00
change_detection refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
compiler refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
debug refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
di refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
dom refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
hydration refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
i18n refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
linker refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
metadata refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
playground/zone-signal-input refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
reflection refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
render3 refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
sanitization refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
signals refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
strict_types refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
testability refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
util refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
zone refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
application_config_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
application_init_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
application_module_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
application_ref_integration_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
application_ref_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
BUILD.bazel test(core): Add scheduler in tests to tie into ApplicationRef.isStable (#53579) 2024-01-09 16:05:31 -08:00
change_detection_scheduler_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
component_fixture_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
defer_fixture_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
dev_mode_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
directive_lifecycle_integration_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
error_handler_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
event_emitter_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
fake_async_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
forward_ref_integration_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
runtime_error_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
test_bed_effect_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
test_bed_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
transfer_state_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
util_spec.ts refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00