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

getState() in actionCreators returns initial state, not current state after a reload #90

Closed
aaronjensen opened this issue Jun 14, 2015 · 5 comments · Fixed by #92
Closed

Comments

@aaronjensen
Copy link
Contributor

In the example app, incrementIfOdd breaks after the first hot reload. getState seems to return the initial state rather than the current state.

@gaearon
Copy link
Contributor

gaearon commented Jun 14, 2015

Good catch, I can reproduce this.

@gaearon
Copy link
Contributor

gaearon commented Jun 14, 2015

If you'd like to add a failing test for this, I would appreciate it!

@aaronjensen
Copy link
Contributor Author

after looking at it briefly, i'm not sure of how to write a test for it. It looks like a new Redux is getting created with a new initialState on hot reload, it's not getting the current state from the old Redux. I'm still getting my bearings though so that could be wrong...

@gaearon
Copy link
Contributor

gaearon commented Jun 14, 2015

The test would create two Redux instances, call redux.replaceDispatcher(nextRedux.getDispatcher()), then fire an action and verify that callback-form action creators still receive the most recent state.

@gaearon
Copy link
Contributor

gaearon commented Jun 14, 2015

I'm currently looking at the underlying problem, but a test would help make sure I actually fix it correctly. :-)

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 a pull request may close this issue.

2 participants