-
Notifications
You must be signed in to change notification settings - Fork 114
location state is not persisted for initial route #165
Comments
Reproduced: https://gfycat.com/ValuableVillainousCanvasback |
Workaround for the moment seems to be immediately dispatching a
|
While debugging something similar (no store.dispatch(replace({})); |
@skattyadz: That will wipe out the query string entirely. {
search: '',
state: {
reduxLittleRouter: {
query: {},
options: {}
}
}
} If you'd rather pass an object to dispatch(replace({
pathname: routerState.pathname
search: routerState.search
})); |
@gshively11's workaround leaves off the hash if there is one. Since I'm not rendering on the server or anywhere that doesn't have const { pathname, search, hash } = window.location;
dispatch(replace(`${pathname}${search}${hash}`)); |
Weird, I can't seem to repro this in the demo. Might have to do with the fact that it's SSRing. @justrossthings if you get a chance, can you send me a repro repo? Otherwise I'll try to disable SSR and reproduce in the demo. |
...wait, that's just |
@tptee probs won't be repro from |
Finally reproduced, even in SSR. This is going to require some refactoring :/ |
https://github.com/FormidableLabs/redux-little-router/blob/master/src/enhancer.js#L34
The location returned by the history listener does not return state (and thus query) for the initial route. Reproduce using this flow:
Expected: the query object should be available on the ROUTER_LOCATION_CHANGED action payload
Result: the query is an empty object (key is undefined and hash is an empty string as well).
I spent a little time trying to track down the root cause, but had to move onto other things, so reproduction steps is the best I can give you at the moment.
The text was updated successfully, but these errors were encountered: