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

New state ignored when reducer returned reference to same state it had received #889

Open
mightyiam opened this issue Jun 30, 2019 · 3 comments

Comments

@mightyiam
Copy link

It seems that when a reducer returns not a new object, but a reference to the same object it received, that reduction is ignored and sources.state.stream does not emit. Am I right about this?

I'm OK with this behavior, as long as it is documented. And perhaps a good exception would help there, as well.
"The following reducer returned a reference to the same state object that it had received. That is not supported. Please modify the reducer to return a new state object."

Pull request welcome?

Versions of packages used:

├─┬ @cycle/dom@22.3.0
│ ├── @cycle/run@5.2.0 deduped
├─┬ @cycle/run@5.2.0
├─┬ @cycle/state@1.2.0
│ ├─┬ @cycle/isolate@5.0.0
│ │ ├── @cycle/run@5.2.0 deduped
│ ├── @cycle/run@5.2.0 deduped
@mightyiam mightyiam changed the title New state ignored when same reference returned from reducer New state ignored when reducer returned reference to same state it had received Jun 30, 2019
@sarimarton
Copy link

I disagree with the need for having an exception for this, but a more detailed documentation is of course can't do any harm.

I guess this dropRepeats() is responsible for the behavior:

.compose(dropRepeats())

@jvanbruegge
Copy link
Member

Yeah, this is intentional and I also don't think adding a warning is necessary, but it would be nice to document this more explicitly

@mightyiam
Copy link
Author

Could you please explain the intention? I can't think of one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants