Skip to content

forceRefetch may lead to swallowed errors #3826

Open
@schadenn

Description

@schadenn

Hi there 👋

We realized yesterday that there may be an issue with forceRefetch (#2663). I'm not sure if the behaviour is intended:
When there is an error within the function passed as forceRefetch, it will trigger a rejected action with an error in it, which is swallowing that error being propagated to anywhere.
I created a reproduction here: https://codesandbox.io/s/rtkquery-forcerefetch-issue-6x4zl5
You can check the console to see the hook state which is stuck in pending (was stuck in uninitialized in our work repo). And the pokemonApi/executeQuery/rejected action which is dispatched on the store which includes the error.

It would've saved us some debugging time if that error would've appeared in the console (without implementing a custom middleware), so I'd like to know if I should create a PR to make this error be thrown - or if implementing a middleware to report these errors is the intended way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions