Skip to content
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

Better (asynchronous) action dispatches #59

Open
IggsGrey opened this issue Mar 21, 2021 · 2 comments
Open

Better (asynchronous) action dispatches #59

IggsGrey opened this issue Mar 21, 2021 · 2 comments

Comments

@IggsGrey
Copy link

In web applications, most actions taken by the user require an API call or need to be executed in the order in which they are created. Consider the following queued actions:

  1. User posts to timeline [postID: 6]
  2. User likes another user's profile
  3. User deletes post from timeline [postID: 6]

While it may not matter the order in which actions 1 and 2 may be executed, it is rather crucial that action 1 is executed before action 3. Since both actions 1 and 3 require API calls, it is possible that the API call for action 3 is executed faster than that of action 1, causing an error or the delete post action to not be executed on the server-side.

Hence it is a better architecture for the queued actions to be executed asynchronously, i.e wait for each action to be executed (saga completed) before dispatching the next queue action. Can we implement this architecture instead of blasting off all the queued actions at once with the forEach loop?

@mir1198yusuf
Copy link

Any updates on this issues ?
Thanks

@mir1198yusuf
Copy link

forEach is here

queue.forEach((actionInQueue) => {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants