fix(zone.js): zone patch rxjs should return null _unsubscribe correctly. (#37091)
Close #31684. In some rxjs operator, such as `retryWhen`, rxjs internally will set `Subscription._unsubscribe` method to null, and the current zone.js monkey patch didn't handle this case correctly, even rxjs set _unsubscribe to null, zone.js still return a function by finding the prototype chain. This PR fix this issue and the following test will pass. ``` const errorGenerator = () => { return throwError(new Error('error emit')); }; const genericRetryStrategy = (finalizer: () => void) => (attempts: Observable<any>) => attempts.pipe( mergeMap((error, i) => { const retryAttempt = i + 1; if (retryAttempt > 3) { return throwError(error); } return timer(retryAttempt * 1); }), finalize(() => finalizer())); errorGenerator() .pipe( retryWhen(genericRetryStrategy(() => { expect(log.length).toBe(3); done(); })), catchError(error => of(error))) .subscribe() ``` PR Close #37091
This commit is contained in:

committed by
Misko Hevery

parent
2b6ab57d78
commit
96aa14df01
@ -27,6 +27,7 @@ import './rxjs.merge.spec';
|
||||
import './rxjs.never.spec';
|
||||
import './rxjs.of.spec';
|
||||
import './rxjs.range.spec';
|
||||
import './rxjs.retry.spec';
|
||||
import './rxjs.throw.spec';
|
||||
import './rxjs.timer.spec';
|
||||
import './rxjs.zip.spec';
|
||||
|
Reference in New Issue
Block a user