Initial load action not triggering thunk (client-only use case)
See original GitHub issueHello! First off: awesome library, I really like the idea behind it!
I’m currently working on an app which will not have SSR.
I’m just refactoring the data fetching strategy from componentDidMount
to within thunks. (As outlined here: https://medium.com/faceyspacey/redux-first-router-data-fetching-solving-the-80-use-case-for-async-middleware-14529606c262)
However I’ve noticed that on the initial load action. (I.e. I go to /
, triggering the respective action defined in routesMap
) it doesn’t trigger the thunk. Now if I understand correctly this has to do with the SSR-aligned philosophy: The state should come from initial state from the reducer when rendering on the server. In my case however this is not viable because I don’t have a server behind the app which can create initial state.
My question is this: What’s the recommended way of doing this? What am I missing?
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
put
redux-localstorage
and as the last enhancer. if that doesnt work, put the thunk middleware last. RFR should come as early as possible. I’ve been meaning to document this.Hi, i have the same issue, but initial
onBeforeChange
didn’t happen this is my config https://gist.github.com/pvpshoot/a24314c85b30c1cea3b5277f13af9594 with or without redux-thunk it doesn’t work RFR - 1.9.19 i just use create react app http://take.ms/IutO9