Skip to content

Allow cancellation of request by allowing the usage of an Abortcontroller and its signal in find and findOne methods #350

@SvenWesterlaken

Description

@SvenWesterlaken

Is your feature request related to a problem? Please describe.

While implementing a search functionality, that uses a debounced watcher, I wanted to implement the standard Abortcontroller to cancel my request whenever a new one was already sent out. However, I could not make this work with the methods in the current version of the Strapi module.

Describe the solution you'd like

In the find & findOne functions, I would like a way to pass through the signal of an Abortcontroller to be able to cancel the active request. This could also be extended to the other functions but I see less of an use case for these.

Describe alternatives you've considered

By using the Strapi client (useStrapiClient()) directly. Although this works, it removes the nice autocorrection and structuring of the predefined methods. And as far as I could find in the code, it should not be too much effort to extend the methods with an extra argument of fetch options. Which would include the signal of an AbortController

Additional context

Some documents about this:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions