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

fix(Observable.toArray): Fix Observable.toArray with multiple subscriptions. #3134

Conversation

josketres
Copy link
Contributor

@josketres josketres commented Nov 28, 2017

Description:
The current implementation of Observable.toArray reuses the same array instance for multiple subscriptions.

This example clarifies why that's wrong.

const Rx = require('rxjs/Rx');
const observable = Rx.Observable.from([1,2]).toArray();
observable.take(1).subscribe(console.log); // prints [ 1, 2 ]
observable.take(1).subscribe(console.log); // prints [ 1, 2, 1, 2 ]

Do not reuse the same array instance for Observable.toArray with
multiple subscriptions.
@josketres josketres force-pushed the fix-to-array-operator-multiple-subscriptions branch from 617e442 to b5ce3ff Compare November 28, 2017 12:56
@rxjs-bot
Copy link

rxjs-bot commented Nov 28, 2017

Messages
📖

CJS: 1381.3KB, global: 750.6KB (gzipped: 120.4KB), min: 145.3KB (gzipped: 31.4KB)

Generated by 🚫 dangerJS

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0008%) to 97.079% when pulling b5ce3ff on josketres:fix-to-array-operator-multiple-subscriptions into 515a753 on ReactiveX:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0008%) to 97.079% when pulling b5ce3ff on josketres:fix-to-array-operator-multiple-subscriptions into 515a753 on ReactiveX:master.

@lock
Copy link

lock bot commented Jun 6, 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 6, 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 this pull request may close these issues.

4 participants