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

remember does not behave as expected #36

Closed
laszlokorte opened this issue May 23, 2016 · 1 comment
Closed

remember does not behave as expected #36

laszlokorte opened this issue May 23, 2016 · 1 comment

Comments

@laszlokorte
Copy link

laszlokorte commented May 23, 2016

When a finite stream is remembered and subscribed twice it behaves strangely.

import xs from 'xstream';

const userXs = xs.of(1, 2, 3)
  .remember()

userXs.addListener({
  next: (x) =>  bin.log("xs first: " + x),
  error: () => null,
  complete: () => bin.log("xs first: complete")
});
// emits: ---1-2-3-|

userXs.addListener({
  next: (x) => bin.log("xs second: " + x),
  error: () => null,
  complete: () => bin.log("xs second: complete")
});
// emits: ---3-1-2-3-|
// expected: ---1-2-3-|

So the remembered value should reset after completion / when the first subscriber is disposed due to completion.

live example: http://www.webpackbin.com/4y9AjrnfZ

@laszlokorte laszlokorte changed the title remember behaves not as expected remember does not behave as expected May 23, 2016
staltz added a commit that referenced this issue May 23, 2016
On tear down, the MemoryStream should set *hasValue* to false.

Fixes issue #36.
@staltz
Copy link
Owner

staltz commented May 23, 2016

Version 2.6.1 released to fix this.

@staltz staltz closed this as completed May 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants