-
Notifications
You must be signed in to change notification settings - Fork 149
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
Mock Store State is not being updated after an action has been dispatched #45
Comments
the same thing happens to me, am I doing anything obviously wrong? Trying to follow the example for testing api requests described here under "Async Action Creators"
And the action is like this:
Any help would be appreciated! |
@michael-iglesias @ericat Could you both provide a repo with the minimum working example or a JS fiddle? It would help me to debug the issue |
@arnaudbenard yes and thanks for the quick reply, I will do it asap, probably in the next few days if that's ok with you. |
@ericat No problem! The source of your problem might be that your action export function loadTodos() {
return (dispatch, getState) => {
const url = '/v1/todos';
return fetch(url, {
credentials: 'same-origin'
})
... |
I'm having this same issue. Maybe I'm not understanding this correctly, but does mock-store actually run the actions through the reducer anywhere? I'm not seeing how they're ever connected with a setup like this: import configureStore from 'redux-mock-store'
import thunk from 'redux-thunk'
const mockStore = configureStore([thunk])
const store = mockStore({ ...state })
console.log(store.getState()) // => { ...state }
store.dispatch(someAction())
console.log(store.getActions()) // => [ someAction() ] The action does show up here!
console.log(store.getState()) // => { ...state } But this is the same unchanged state as above |
I don't get this: why I can't see the updated state here https://github.com/damianobarbati/react-redux-test/blob/master/test.js#L49 if I add |
@adamyonk you need to use your reducer like this |
Can you explain it better? |
Was the issue solved? I am having the same issue. Tried 1.5.3 and 1.5.4 versions.
OR:
I always see only the first action in store.getActions() but not the second. In both cases 2nd action is dispatched which I see by simply printing it out with console.log(). |
Hello,
For some reason the state within my mocked store is not being updated after an action has been dispatched. I've pasted my unit test below. Any suggestion on how to proceed would be greatly appreciated.
The text was updated successfully, but these errors were encountered: