We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c0a1bbe commit f239184Copy full SHA for f239184
src/internal/operators/finalize.ts
@@ -69,7 +69,15 @@ class FinallyOperator<T> implements Operator<T, T> {
69
}
70
71
call(subscriber: Subscriber<T>, source: any): TeardownLogic {
72
- return source.subscribe(new FinallySubscriber(subscriber, this.callback));
+ // The returned subscription will usually be the FinallySubscriber.
73
+ // However, interop subscribers will be wrapped and for
74
+ // unsubscriptions to chain correctly, the wrapper needs to be added, too.
75
+ const finallySubscriber = new FinallySubscriber(subscriber, this.callback);
76
+ const subscription = source.subscribe(finallySubscriber);
77
+ if (subscription !== finallySubscriber) {
78
+ subscription.add(finallySubscriber);
79
+ }
80
+ return subscription;
81
82
83
0 commit comments