reduxjs / redux-toolkit

The official, opinionated, batteries-included toolset for efficient Redux development
https://redux-toolkit.js.org
MIT License
10.69k stars 1.16k forks source link

[RTK-Query]: `useQuery` hook does not refetch after `resetApiState` (2) #3778

Open manceauJb opened 1 year ago

manceauJb commented 1 year ago

Description:

This issue appears to be a bug in RTK-Query, which should have been resolved by #1735 and #3333. However, it appears that the problem persists.

Reproduction Steps:

  1. Access the following example showcasing the issue: CodeSandbox
  2. Click on the "Rerender Component" button.
  3. Click on the "Reset Api State" button.

Expected Behavior:

After clicking "Reset API State," the request should not remain stuck in a pending status. Instead, it should automatically re-fetch the query. Currently, the request remains pending until the component is re-rendered. Even if we attempt to manually refetch, the query is executed, but the result remains pending.

phryneas commented 12 months ago

Yup, I can see that. Weird that it only happens after a rerender 🤔

etozhealkhipce commented 11 months ago

@phryneas

Is there any fixes for this? I have same issue on my project

bennyszantar commented 11 months ago

Same thing in my project.