Skip to content
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

Incorrect AsyncSubject behaviour #1800

Closed
unao opened this issue Jul 4, 2016 · 3 comments · Fixed by #1801
Closed

Incorrect AsyncSubject behaviour #1800

unao opened this issue Jul 4, 2016 · 3 comments · Fixed by #1801

Comments

@unao
Copy link

unao commented Jul 4, 2016

RxJS version: https://cdnjs.cloudflare.com/ajax/libs/rxjs/5.0.0-beta.9/Rx.umd.js

Code to reproduce:

var subject = new Rx.AsyncSubject();

subject.next(1);
subject.complete();
subject.subscribe(v => console.log(v));

subject.next(2);
var sub = subject.subscribe(v => console.log(v));

PLNKR

Expected behavior:
subject.next(2) should have no effect.

Actual behavior:
It is possible to publish values after the stream completed.
1 is the result of the async computation and it should be used for any future subscribes.

Additional information:
afaik, it violates the Observable interface.

@unao
Copy link
Author

unao commented Jul 4, 2016

This one is pretty interesting as well:

var subject = new Rx.AsyncSubject();

subject.asObservable().delay(0).subscribe(v => console.log('delayed', v));

subject.next(1);
subject.complete();
subject.subscribe(v => console.log(v));

subject.next(2);

subject.asObservable().subscribe(v => console.log(v));

PLNKR

@kwonoj
Copy link
Member

kwonoj commented Jul 4, 2016

indeed, seems current implementation missing guard to next when it's completed.

kwonoj added a commit to kwonoj/rxjs that referenced this issue Jul 4, 2016
kwonoj added a commit to kwonoj/rxjs that referenced this issue Jul 8, 2016
kwonoj added a commit to kwonoj/rxjs that referenced this issue Jul 8, 2016
kwonoj added a commit to kwonoj/rxjs that referenced this issue Jul 9, 2016
kwonoj added a commit to kwonoj/rxjs that referenced this issue Jul 10, 2016
kwonoj added a commit to kwonoj/rxjs that referenced this issue Jul 10, 2016
kwonoj added a commit to kwonoj/rxjs that referenced this issue Jul 10, 2016
kwonoj added a commit to kwonoj/rxjs that referenced this issue Jul 11, 2016
kwonoj added a commit to kwonoj/rxjs that referenced this issue Jul 11, 2016
kwonoj added a commit to kwonoj/rxjs that referenced this issue Jul 12, 2016
kwonoj added a commit to kwonoj/rxjs that referenced this issue Jul 17, 2016
@lock
Copy link

lock bot commented Jun 7, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants