-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
facing slowness in user actions done through thunk middleware #1190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Promise.all() may be |
Promise.all() will not work for actions depending on sequence. await fixes issue of bringing actions in sequence. |
We have a problem with promises > Advanced mistake #3: promises vs promise factories |
Please format Your code so it's easier to read and add syntax highlighting. Can You give more info on Your use case ? Do You use Which component is being rerendered ? Is it Your component or one of the components that come with RSK ? |
No, but mine is a normal connected component with redux-thunk middleware. |
Gotya. In that case You'll see rerender of Your component every time You dispatch an action which changes part of state that component is connected to. What I usually do is extract logic contained in actions to methods and execute them in necessary order. Then when all data is ready, dispatching single action with this data. This might not be the case for You, as from what I see, Your actions depend on data in state set by other actions. In that case You might consider connecting Your component to part of state that is being changed by the last dispatched action. But again, this is very dependent on the way how Your state is designed. I would need to have more specific examples, so that I can fully understand Your use case. This is not an issue of RSK itself, it's just how redux works. ;) |
I guess your solution is similar to redux-batched-subscribe and its giving good improvement. |
@shishirarora3 thank you very much for crating this issue! Unfortunately, we have close it due to inactivity. Feel free to re-open it or join our Discord channel for discussion. NOTE: The |
Uh oh!
There was an error while loading. Please reload this page.
Hi,
Anyone facing slowness in user actions. Sometimes a user action might dispatch many actions. Every action causes rerender of react.
I am using above pattern of actions with redux-thunk.
One option of redux-batched-subscribe in middleware helped in batching concurrent actions( setNormalAction*) and hence saved some renders. But still the performance is bad because of sequence required in thunk actions(setAction1*).
Any other approaches, you are following to scale this?
The text was updated successfully, but these errors were encountered: