NoteThis queue processes tasks sequentially (one by one). If a task hangs or takes a long time, it will block all subsequent tasks in the queue.
The useTaskQueue hook provides a reliable way to handle a series of asynchronous operations (Tasks) that must be executed one after another. It maintains an internal queue and automatically triggers the execution loop as new tasks are added. This is particularly useful for scenarios like processing sequential API uploads, database synchronizations, or any operation where race conditions must be avoided by ensuring only one task runs at a time.
| Name | Type | Description |
|---|---|---|
| enqueue | (task: Task<T>) => void | Adds a new task to the end of the queue. |
| queue | Task<T>[] | A reactive array containing the tasks currently waiting in the queue. |
| running | boolean | A reactive state indicating if a task is currently being executed. |
Pending Queue (0)
Completed Tasks (0)