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.

Feature proposal. Thunk actions names in devtools

See original GitHub issue

I was writing a complex interaction in my react-rudux application and then I noticed that devtools only shows synchronous actions.

In my case component dispatches a thunk action then this action dispatches actions (objects) and may or may not dispatch another thunk or asynchronous (this a thunk action that makes a back-end request) action.

So, it would be super useful to get to know what exact action is now dispatching.

In example below thunk actions have simple actions dispatching inside them:

thunkAddMembers  {
       asyncAddItemsAction {
              asyncPatchItems {
                      beginModify
                      updatMembers
              }
             endModify
       }
       clearInput
       closeInput       
}

On a second thought It feels like I can do it my own with a little help from community, of course)))

So, before I get started there’are some questions to ask:

About idea at all:

  1. Firstly It’ll be nice to hear your thoughts.
  2. If I have a question about existing code where can I ask it?

About getting started.

  1. I found the CODE_OF_CONDUCT but are there more detailed instructions?
  2. How would you start building this functionality? Is it better to build it as a addition to present code or make a plug-in or something like that?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
aguynamedbencommented, Feb 5, 2020

I also was wondering if Thunk actions could be shown in the UI. The trace functionality allowed me to verify a Redux action was triggered by a Thunk action, but it’d be very, very cool if Thunk actions could show up on the left side along with Redux actions.

I have some more specific ideas of how this would work below. I realize you’re the maintainer of a popular open source project, and you probably don’t have time to implement all these ideas, but if the idea of more support for redux-thunk support keeps coming up with other users, here’s what I’d like to see. Thank you for the time you spend on this project. 🙏 🙏 🙏


💡

My app relies a lot of Thunk actions, which yes, are just special-case JavaScript functions, not true Redux actions (i.e. there no action.type), but it would be SO cool if the Redux DevTools Extension could show Thunk actions along with Redux actions.

Ideally the Thunk function names could show up in the left side list, along side the “proper” action.type values. When you click the name of a Thunk function, maybe the Action tab could show the arguments.

Following the redux-thunk readme examples… there’s a Thunk action called makeASandwichWithSecretSauce(forPerson). It’d be cool if makeASandwichWithSecretSauce appears in the left, maybe with a small “THUNK” tag. It’d probably be followed by true Redux action.type values, i.e. MAKE_SANDWICH. If you clicked the Thunk function name, you’d see forPerson: 'My partner'.

1reaction
zalmoxisuscommented, Dec 10, 2018

You should get all actions in devtools even if they are not called synchronously using thunks. But I think by action names you meant not action.type, but thunk functions names. We’ll have that feature implemented this week (I’m working on #429), so you’ll see all functions call stack for a specific action.

It works well with async/await, but not with setTimeout, which breaks the stack (so here it’ll not know that it was called from inside incrementAsync. In this case one should either keep track of the stack before and provide it to our trace argument or redefine setTimeout adding the stack wherever it’s called.

I’ll ping you here when it’s ready to be tested.

Feel free to ask questions about the code here. The plan is to move everything inside monorepo and provide contribution guide.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring thunk action creators and redux dev-tools with ...
Devtools will only initialize if the name parameter is passed. See below. Usage: The above useReducer — React redux hook can be used...
Read more >
Redux Dev Tools not working for large action payload
I'm working on a react/redux application and am having a problem using the time travel feature in redux dev tools chrome extension. When...
Read more >
Chapter 3. Debugging Redux applications - Redux in Action
The Redux DevTools can be used to display actions in real time. ... or dependency is required to use time-travel debugging; it's a...
Read more >
8 Lesser Known but KILLER Features of Chrome DevTools
The Chrome DevTools is one of the biggest reasons developers refuse to touch any other browser. But most of us use only a...
Read more >
How to use the redux dev tools to speed up development and ...
As seen now, we have @@INIT action type but the todos array is populated from the committed actions. The DevTools also offers a...
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