angular/packages/platform-server/src
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
..
bundled-domino.d.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
domino_adapter.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
http.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
location.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
platform-server.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
platform_state.ts refactor(platform-server): Add an ssr benchmark setup. (#57647) 2024-10-04 10:45:22 -07:00
private_export.ts refactor(platform-server): Add an ssr benchmark setup. (#57647) 2024-10-04 10:45:22 -07:00
provide_server.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
server.ts refactor(platform-server): Add an ssr benchmark setup. (#57647) 2024-10-04 10:45:22 -07:00
server_events.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
tokens.ts refactor(platform-server): Add an ssr benchmark setup. (#57647) 2024-10-04 10:45:22 -07:00
transfer_state.ts refactor(platform-server): Add an ssr benchmark setup. (#57647) 2024-10-04 10:45:22 -07:00
types.d.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
utils.ts fix(platform-server): destroy PlatformRef when error happens during the bootstrap() phase (#58112) 2024-10-09 12:12:34 +00:00
version.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00