Skip to content

Conversation

@elon-gs
Copy link

@elon-gs elon-gs commented Apr 19, 2018

Callbacks aren't working for me with 2.0.2. I believe the condition I've changed was to blame.

Copy link

@ehaynes99 ehaynes99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. This bug is actually more sinister than just not calling them. It calls the callback n - 1 times, where n is the number of subscribers. If n === 1, it gets called zero times, but if n === 4, it gets called 3 times.

@individual11

This comment has been minimized.

@RiCoTeRoX

This comment has been minimized.

@bnolan

This comment has been minimized.

@jherencia
Copy link

I'm having the same problem and this commit fixed it.

@jamiebuilds Probably is a big bug, if you need some help to test it, i'll be happy to try.

@chip4
Copy link

chip4 commented May 11, 2018

Created a CodeSandbox demonstrating the issue: https://codesandbox.io/s/k9n8x5p447.
In the current release of unstated (2.0.3) setState callbacks are unusable. Given that a goal of this library (as I understand it from here: #1 (comment)) is to make it as seamless as possible to refactor component state into container state and that React's setState supports callbacks, I think this is an issue worth addressing.
What needs to happen to get this fix merged?

Thanks for all the hard work that goes into building and maintaining this!

@ehaynes99 ehaynes99 mentioned this pull request May 15, 2018
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

Successfully merging this pull request may close these issues.

8 participants