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

[ui-core] adds useQueueProcessor hook to manage concurrent async task #3890

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ramprasadagarwal
Copy link
Collaborator

What changes were proposed in this pull request?

  • This hook manages the list of async task that need to be processed in controlled way.

How was this patch tested?

  • Added unit tests

Copy link
Collaborator

@bjornalm bjornalm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but I have a couple of questions for you to explore. Also see comment and potentially fix the "unsafe" state mutation

-What happens if I use this from my parent component, start a process of 100 items one at a time and then wants to cancel?
-What happens if I unmount my parent component during the process?
-Any risk for unexpected continued processing or memory leaks in the above scenarios?

);

const processQueueItem = async () => {
const nextItem = pendingQueue.shift();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is modifying the state without using setPendingQueue

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

Successfully merging this pull request may close these issues.

2 participants