react-redux-realworld-example-app icon indicating copy to clipboard operation
react-redux-realworld-example-app copied to clipboard

Get viewChangeCounter at middleware is always undefined

Open vietthanhbk1994 opened this issue 6 years ago • 2 comments

https://github.com/gothinkster/react-redux-realworld-example-app/blob/cde269d554ac2f1f298c56dbeff1fbd12ee08b92/src/middleware.js#L14 https://github.com/gothinkster/react-redux-realworld-example-app/blob/cde269d554ac2f1f298c56dbeff1fbd12ee08b92/src/middleware.js#L20 https://github.com/gothinkster/react-redux-realworld-example-app/blob/cde269d554ac2f1f298c56dbeff1fbd12ee08b92/src/middleware.js#L30

  • viewChangeCounter belong to state.common https://github.com/gothinkster/react-redux-realworld-example-app/blob/cde269d554ac2f1f298c56dbeff1fbd12ee08b92/src/reducers/common.js#L23 so to get viewChangeCounter, you must through state.common
  • store.getState().viewChangeCounter; should be store.getState().common.viewChangeCounter;
  • currentState.viewChangeCounter should be currentState.common.viewChangeCounter

vietthanhbk1994 avatar Mar 23 '18 10:03 vietthanhbk1994

Same.

BTW, in my mind, viewChangeCounter is not a nice way to track async function. Is there a better solution?

zhangyu921 avatar Jul 17 '19 10:07 zhangyu921

Same as well. I was wondering why it isn't 'store.getState().common.viewChangeCounter'

l4d2boomer avatar Mar 18 '21 15:03 l4d2boomer