Skip to content

Commit e21c62b

Browse files
martinsikbenlesh
authored andcommitted
refactor(retryWhen/repeatWhen): Refactor "fooling" the _unsubscribe method (#3295)
1 parent 51848fc commit e21c62b

2 files changed

Lines changed: 8 additions & 15 deletions

File tree

src/internal/operators/repeatWhen.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,12 @@ class RepeatWhenSubscriber<T, R> extends OuterSubscriber<T, R> {
100100
}
101101

102102
protected _unsubscribeAndRecycle(): Subscriber<T> {
103-
const { notifications, retries, retriesSubscription } = this;
104-
this.notifications = null;
105-
this.retries = null;
106-
this.retriesSubscription = null;
103+
const { _unsubscribe } = this;
104+
105+
this._unsubscribe = null;
107106
super._unsubscribeAndRecycle();
108-
this.notifications = notifications;
109-
this.retries = retries;
110-
this.retriesSubscription = retriesSubscription;
107+
this._unsubscribe = _unsubscribe;
108+
111109
return this;
112110
}
113111

src/internal/operators/retryWhen.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,11 @@ class RetryWhenSubscriber<T, R> extends OuterSubscriber<T, R> {
102102
notifyNext(outerValue: T, innerValue: R,
103103
outerIndex: number, innerIndex: number,
104104
innerSub: InnerSubscriber<T, R>): void {
105-
const { errors, retries, retriesSubscription } = this;
106-
this.errors = null;
107-
this.retries = null;
108-
this.retriesSubscription = null;
105+
const { _unsubscribe } = this;
109106

107+
this._unsubscribe = null;
110108
this._unsubscribeAndRecycle();
111-
112-
this.errors = errors;
113-
this.retries = retries;
114-
this.retriesSubscription = retriesSubscription;
109+
this._unsubscribe = _unsubscribe;
115110

116111
this.source.subscribe(this);
117112
}

0 commit comments

Comments
 (0)