Skip to content

Commit 5c31e7e

Browse files
arturovtkirjs
authored andcommitted
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
1 parent eb62a58 commit 5c31e7e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/core/rxjs-interop/src/to_signal.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ export function toSignal<T, U = undefined>(
168168
next: (value) => state.set({kind: StateKind.Value, value}),
169169
error: (error) => {
170170
state.set({kind: StateKind.Error, error});
171+
destroyUnregisterFn?.();
171172
},
172173
complete: () => {
173174
destroyUnregisterFn?.();

0 commit comments

Comments
 (0)