question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Initial load action not triggering thunk (client-only use case)

See original GitHub issue

Hello! 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:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
faceyspaceycommented, Aug 1, 2017

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.

0reactions
pvpshootcommented, Jun 1, 2018

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redux action not triggering particular reducer - Stack Overflow
The set user and set admin actions are used in the App component, and seem to fire and update the redux state without...
Read more >
Redux-Observable will solve your state problems. - ITNEXT
There are no Redux actions being emitted to trigger the app version logging. While this may seem like a good idea at first,...
Read more >
Which HTTP verb should I use to trigger an action in a REST ...
I don't think there is a proper verb for this action because this transaction isn't really "RESTful." The "s" and "t" stand for...
Read more >
Why you shouldn't use Redux? - Expansio
When you're developing a smaller application, it is not a bad idea to abandon Redux library altogether. Often a large amount of code...
Read more >
Usage Guide - Redux Toolkit
redux-thunk is the most commonly used middleware for working with both ... First, Redux action types are not meant to be exclusive to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found