I have an avatar component used for displaying avatar of users and that component is used on multiple other components. Each avatar component tries to get the user from the server. But I am seeing a lot of actions dispatched from multiple components. Here is what I want to do: check if an entity exists before dispatching the action? Is there a way to get the current snapshot of the store?
Asked
Active
Viewed 365 times
0
-
Please share some code :-) – BizzyBob Apr 08 '21 at 11:00
-
You could dispatch the action, but not send the request from the effect in case of existing value. Use for example the withLatestFrom operator here. – MoxxiManagarm Apr 08 '21 at 11:51
-
Yes, I did that but I see the same action being dispatched with redux dev tools. Is that OK? If it's being dispatched from multiple places, wouldn't it cause performance issues? – Nebex Elias Apr 08 '21 at 13:46