react-redux-starter-kit
react-redux-starter-kit copied to clipboard
updateLocation thunk strange behaviour
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
I'm having the same problem, have you managed to solve it ?
@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.