mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(core): unregister onDestroy when observable errors in toSignal (#61596)
The observable terminates immediately when `error` is called, and no further emissions or completion notifications occur. Thus, we have to remove the listener in both the `error` and `complete` notifications. PR Close #61596
This commit is contained in:
@@ -168,6 +168,7 @@ export function toSignal<T, U = undefined>(
|
||||
next: (value) => state.set({kind: StateKind.Value, value}),
|
||||
error: (error) => {
|
||||
state.set({kind: StateKind.Error, error});
|
||||
destroyUnregisterFn?.();
|
||||
},
|
||||
complete: () => {
|
||||
destroyUnregisterFn?.();
|
||||
|
||||
Reference in New Issue
Block a user