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

toArray() duplicates items for each subscription #3141

Closed
martinhrvn opened this issue Nov 29, 2017 · 2 comments
Closed

toArray() duplicates items for each subscription #3141

martinhrvn opened this issue Nov 29, 2017 · 2 comments
Labels
bug Confirmed bug

Comments

@martinhrvn
Copy link

RxJS version:
5.5.2

Code to reproduce:

const count = Rx.Observable.interval(1000).take(10)
const countArray = count.toArray()
countArray.subscribe(i => console.log(i))
countArray.subscribe(i => console.log(i))

Expected behavior:
In both cases an array with 0 to 9 is returned:

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

Actual behavior:
The values returned are duplicated for each subscription:

[0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9]
[0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]

Additional information:
This is a regression from 5.4.3, where the values are as expected

@benlesh
Copy link
Member

benlesh commented Mar 16, 2018

@kwonoj I believe your PR the other day fixed this.

@benlesh benlesh closed this as completed Mar 16, 2018
@lock
Copy link

lock bot commented Jun 5, 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 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Confirmed bug
Projects
None yet
Development

No branches or pull requests

3 participants