fix(core): check ngDevMode for undefined (#60565)

This adds a check to "toSignal" whether ngDevMode is not undefined as this can happen for some MFE applications.

PR Close #60565
This commit is contained in:
Benjamin Pabst
2025-03-26 14:43:32 +01:00
committed by Jessica Janiuk
parent ca5aa4d55b
commit 64da69f7b6
+2 -1
View File
@@ -134,7 +134,8 @@ export function toSignal<T, U = undefined>(
source: Observable<T> | Subscribable<T>,
options?: ToSignalOptions<T | U> & {initialValue?: U},
): Signal<T | U> {
ngDevMode &&
typeof ngDevMode !== 'undefined' &&
ngDevMode &&
assertNotInReactiveContext(
toSignal,
'Invoking `toSignal` causes new subscriptions every time. ' +