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

Remembered stream does not add listener when source is created directly via 'xs.create' #69

Closed
ntilwalli opened this issue Jul 5, 2016 · 2 comments

Comments

@ntilwalli
Copy link

ntilwalli commented Jul 5, 2016

I noticed this odd behavior (what looks like a bug). When remember is called directly on a raw stream created via xs.create that has no producer (i.e. which will emit based on the shamefully* methods), it doesn't add listeners since the _prod property is undefined.

import xs from 'xstream'

const test$ = xs.create()

// This line works
//const oddBehavior$ = test$  

// This line does not work. Why?
const oddBehavior$ = test$.remember()

oddBehavior$.addListener({
  next: n => bin.log(`Next: ${n}`),
  error: e => bin.log(`Error: ${e}`),
  complete: () => bin.log(`Complete`)
})

test$.shamefullySendNext(1)

You can see the issue here: http://www.webpackbin.com/4JFCBWrL-

@ntilwalli
Copy link
Author

ntilwalli commented Jul 5, 2016

Discussion of the issue on Gitter is here: https://gitter.im/cyclejs/core?at=577c364a4e50bf894a20066b

@staltz staltz closed this as completed in #70 Jul 6, 2016
staltz pushed a commit that referenced this issue Jul 6, 2016
Fixes issue #69.

* Prevent stack overflow while detecting cycles in _onlyReachesThis

* fix `remember` for usage with 'subjects'

* add test

* fix test

* fix(flatten): fix broken flatten on empty outer

Flatten should do a check if the inner stream is null when stopping the FlattenOperator, before
removing the listener from the inner stream.

* chore(package): release new version

* fix `remember` for usage with 'subjects'

* add test

* fix test

* split tests
@staltz
Copy link
Owner

staltz commented Jul 6, 2016

Fixed in v5.1.3

@staltz staltz reopened this Jul 6, 2016
@staltz staltz closed this as completed Jul 6, 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