refactor(core): drop injection context assertion in production (#62038)

Drops `assertInInjectionContext` call in production in `afterNextRender`.

PR Close #62038
This commit is contained in:
arturovt 2025-06-13 02:36:52 +03:00 committed by Jessica Janiuk
parent 8d049f533a
commit 21dfbf3ada

View file

@ -389,7 +389,10 @@ export function afterNextRender(
},
options?: AfterRenderOptions,
): AfterRenderRef {
!options?.injector && assertInInjectionContext(afterNextRender);
if (ngDevMode && !options?.injector) {
assertInInjectionContext(afterNextRender);
}
const injector = options?.injector ?? inject(Injector);
if (typeof ngServerMode !== 'undefined' && ngServerMode) {