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.

`store.dispatch` does not work in 1.2.2

See original GitHub issue

After migrating to 1.2.2 store.dispatch stopped working with the following error message:

Argument of type 'ThunkAction<void, CombinedState<{ auth: AuthState; }>, null, Action<string>>' is not assignable to parameter of type 'AnyAction'.
  Property 'type' is missing in type 'ThunkAction<void, CombinedState<{ auth: AuthState; }>, null, Action<string>>' but required in type 'AnyAction'.

Dispathing through dispatcher from hook works fine though:

  const dispatch = useDispatch();
  ...
  dispatch(logOut());  // OK

I can’t use React Hooks in the axios interceptor, so I was using this:

import store from '../../store';

store.dispatch(logOut());

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
belgattitudecommented, Jan 24, 2020

@phryneas

Updated to unknown type and installed the sandbox… it seems to work 😉

Thanks for your help, very clear and super pro… Amazing 😃

2reactions
belgattitudecommented, Jan 24, 2020

@phryneas,

Does it work if you change it like this?

+ export type AppThunk = ThunkAction<void, RootState, undefined, Action<string>>;

Nope

error TS2345: Argument of type 'null' is not assignable to parameter of type 'undefined'.
55  await runLogoutThunk({ tokenStore: ts })(dispatch, getState, null);

Setting it to unknown does the job, but I’m not sure about the implications.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redux Dispatch Does Not Work - ADocLib
After migrating to 1.2.2 store.dispatch stopped working with the following error message: Argument of type 'ThunkAction null Action >' is. We can't call ......
Read more >
Executing code after dispatch is completed while using ngrx
Quick answer : You can't. As you said, dispatch is asynchronous. What you should do is use @ngrx/effects. It's nearly the same as...
Read more >
Troubleshooting | Redux
Sometimes, you are trying to dispatch an action, but your view does not update. Why does this happen? There may be several reasons...
Read more >
Fragment - Android Developers
Declaring dependencies. To add a dependency on Fragment, you must add the Google Maven repository to your project. Read Google's Maven repository for...
Read more >
Standard Practice for Emergency Medical Dispatch ...
1.1 This practice covers the function of the emergency medical dispatcher (EMD). This function is the prompt and accurate processing of ...
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