react-redux-starter-kit icon indicating copy to clipboard operation
react-redux-starter-kit copied to clipboard

updateLocation thunk strange behaviour

Open gitteraz opened this issue 8 years ago • 2 comments

hi, i am using the kit in my recent dashboard app. This is my first time using redux and your Starter kit made it very easy to catch up, Thank you!

One thing i am missing is why the LOCATION_CHANGE action creator doesn't always run the returning function when path changes,causing the location state to be always null.

export const updateLocation = ({ dispatch }) => {
 // this next block doesn't run (function stops here)
  return (nextLocation) => {
  	dispatch(locationChange(nextLocation))
  }
}

Aditional info It happens even with a fresh installation of the starter kit when i include '#' to an url e.g 'localhost:3000#' it works and location state is updated successfully

Please point me in the right direction

gitteraz avatar Jan 15 '17 00:01 gitteraz

I'm having the same problem, have you managed to solve it ?

awartoft avatar Jan 17 '17 19:01 awartoft

@macnibblet i don't know if it's the right thing to do, will wait for proper fix but meanwhile i got it working by passing initial location state from window.location object.

in src/main.js

changed: const initialState = window.___INITIAL_STATE__

to: const initialState = { location : { hash: window.location.hash, pathname: window.location.pathname, search: window.location.search, key: null } }

And now the location state is updated.

gitteraz avatar Jan 19 '17 18:01 gitteraz