feat(useAsyncQueue): add options.signal
parameter
#3033
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before submitting the PR, please make sure you do the following
fixes #123
).Description
The signal option can be set to an AbortSignal to allow aborting an asynchronous queue task via the corresponding AbortController.
Example
Additional context
🤖 Generated by Copilot at 986338d
The pull request enhances the
useAsyncQueue
function to allow canceling async tasks with anAbortSignal
. It also improves the code quality and testing of the function and its related files.🤖 Generated by Copilot at 986338d
AbortSignal
(link, link, link, link, link, link)UseAsyncQueueResult
interface to includecanceled
state (link)signal
property toUseAsyncQueueOptions
interface (link)Promise.race
to resolve or reject promise based on signal or task outcome (link)AbortError
class and helper functionwhenAborted
(link)AbortSignal
inindex.test.ts
(link)index.test.ts
(link, link, link, link)expect
andtoBe
(link)it
functions (link, link, link)