fix(skipUntil): fix skipUntil when innerSubscription is null#3686
fix(skipUntil): fix skipUntil when innerSubscription is null#3686benlesh merged 3 commits intoReactiveX:masterfrom
Conversation
|
Your fix looks appropriate, to me, but, ideally, the PR should also include a test that's based on code that reproduces the error. The problem is effected because the implementation doesn't account for the synchronous completion of the notifier. You don't need to use a import { of } from "rxjs";
import { skipUntil } from "rxjs/operators";
of(1).pipe(
skipUntil(of(2))
).subscribe(x => console.log(x)); |
|
@cartant I've just simplified my usage example and opened an issue. I m unsure how to do the test if you can guide me I will appreciate it. |
|
Sure. Interestingly, I cannot get a marble test to effect the error, so I'd just add a test based on the repro. You could add one like this: it('should emit elements after a synchronous notifer emits', () => {
const values: string[] = [];
of('a', 'b').pipe(skipUntil(of('x'))).subscribe(
value => values.push(value),
err => { throw err; },
() => expect(values).to.deep.equal(['a', 'b'])
);
});I'd add it after the test named Once you've added the test to the file, run |
|
@cartant thanks a lot for your help. |
src/internal/operators/skipUntil.ts
Outdated
| innerSub: InnerSubscriber<T, R>): void { | ||
| this.hasValue = true; | ||
| this.innerSubscription.unsubscribe(); | ||
| if(this.innerSubscription) { |
There was a problem hiding this comment.
This is just nitpicking but in all code around here there's always space between if and the starting parenthesis if (this.innerSubscription).
Generated by 🚫 dangerJS |
|
@cartant / @martinsik any progress on this? its quite important this for me because without it i cannot migrate to rxjs 6 |
|
@claylaut The repository's maintainers will eventually get around to reviewing and, likely, merging your PR. You will just need to be a little patient, as they're busy people with other priorities. In the interim, you could use a scheduler for a temporary workaround: import { asapScheduler, of } from "rxjs";
import { skipUntil } from "rxjs/operators";
of(1).pipe(
skipUntil(of(2, asapScheduler)) // or skipUntil(of(2).pipe(subscribeOn(asapScheduler)))
).subscribe(x => console.log(x)); |
|
Thanks, @claylaut! |
Description: Fix a minor issue with skipUntil
Related issue:
#3685