You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current Behavior
Calling retry(0) will produce EMPTY obervable, so upstream will never be subscribed to.
retry(0) => 0 upstream subscriptions. retry(1) => 1 upstream subscription and up to 1 resubscription. retry(2) => 1 upstream subscription and up to 2 resubscriptions.
This breaks the scenario when retries can be turned on and off with a parameter.
Expected behavior
Calling retry(0) will produce an operator that subscribes to upstream only once.
retry(0) => 1 upstream subscription. retry(1) => 1 upstream subscription and up to 1 resubscription. retry(2) => 1 upstream subscription and up to 2 resubscriptions.
With previos behavior retry(param) where param=0 just turns retries off.
Reproduction
import { of } from "rxjs";
import { map, retry } from "rxjs/operators";
const source = of("World").pipe(
map(x => `Hello ${x}!`),
retry(0)
);
source.subscribe(console.log);
Yep, I also think that this is a bug, because the following test currently fails:
it('should not alter the source when the number of retries is smaller than 1',()=>{constsource=cold('--1-2-3-#');constsubs=['^ !'];constexpected='--1-2-3-#';constunsub=' !';constresult=source.pipe(retry(0));expectObservable(result,unsub).toBe(expected);expectSubscriptions(source.subscriptions).toBe(subs);})
It's an easy fix. I'm pretty sure that the PR that I've opened fixes the issue.
Bug Report
Current Behavior
Calling
retry(0)
will produceEMPTY
obervable, so upstream will never be subscribed to.retry(0)
=> 0 upstream subscriptions.retry(1)
=> 1 upstream subscription and up to 1 resubscription.retry(2)
=> 1 upstream subscription and up to 2 resubscriptions.This breaks the scenario when retries can be turned on and off with a parameter.
Expected behavior
Calling
retry(0)
will produce an operator that subscribes to upstream only once.retry(0)
=> 1 upstream subscription.retry(1)
=> 1 upstream subscription and up to 1 resubscription.retry(2)
=> 1 upstream subscription and up to 2 resubscriptions.With previos behavior
retry(param)
whereparam=0
just turns retries off.Reproduction
Ver 6.6.7: https://rxjs-fdhbub.stackblitz.io
You will see "Hello World" in the console once.
Ver 7.0.0: https://rxjs-xeymgx.stackblitz.io
The console will be empty.
Possible Solution
retry(0)
should work as in 6.6.7, as it aligns with expectations that there always will be one upstream subscription.The text was updated successfully, but these errors were encountered: