Skip to content

useRetry hook leaves loading stuck true after a successful retry #4

Description

@abayomicornelius

In src/hooks/useRetry.ts, the run callback's success path does await fn(); setAttempt(0); return inside the for-loop, which exits the function before the trailing setLoading(false) after the loop is ever reached.

Any component relying on useRetry's loading flag to disable a button or show a spinner will have it stuck true forever after a successful call. Move setLoading(false) into a finally block or explicitly set it before each return.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions