angular/packages/platform-server
Krzysztof Platis 9e82559de4 fix(platform-server): destroy PlatformRef when error happens during the bootstrap() phase (#58112)
The `bootstrap()` phase might fail e.g. due to an rejected promise in some `APP_INIIALIZER`.
If `PlatformRef` is not destroyed, then the main app's injector is not destroyed and therefore `ngOnDestroy` hooks of singleton services is not called on the end (failure) of SSR.

This could lead to possible memory leaks in custom SSR apps, if their singleton services' `ngOnDestroy` hooks contained an important teardown logic (e.g. unsubscribing from RxJS observable).

Note: I needed to fix by the way another thing too: now we destroy `moduleRef` when `platformInjector` is destroyed - by setting a `PLATFORM_DESTROY_LISTENER`

fixes #58111

PR Close #58112
2024-10-09 12:12:34 +00:00
..
init refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
src fix(platform-server): destroy PlatformRef when error happens during the bootstrap() phase (#58112) 2024-10-09 12:12:34 +00:00
test fix(platform-server): destroy PlatformRef when error happens during the bootstrap() phase (#58112) 2024-10-09 12:12:34 +00:00
testing refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
BUILD.bazel refactor(platform-server): Add an ssr benchmark setup. (#57647) 2024-10-04 10:45:22 -07:00
index.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
package.json feat(bazel): remove unused ESM2022 from APF (#57559) 2024-08-28 08:45:38 -07:00
PACKAGE.md docs: drop glossary links (#55044) 2024-03-28 13:02:50 -07:00
public_api.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00