-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(skipUntil): fix skipUntil when innerSubscription is null #3686
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
@@ -57,7 +57,9 @@ class SkipUntilSubscriber<T, R> extends OuterSubscriber<T, R> { | |||
outerIndex: number, innerIndex: number, | |||
innerSub: InnerSubscriber<T, R>): void { | |||
this.hasValue = true; | |||
this.innerSubscription.unsubscribe(); | |||
if(this.innerSubscription) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just nitpicking but in all code around here there's always space between if
and the starting parenthesis if (this.innerSubscription)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@martinsik fixed
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