Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resetApiState is not resetting the local state of the hook #4009

Open
saibs opened this issue Dec 22, 2023 · 3 comments
Open

resetApiState is not resetting the local state of the hook #4009

saibs opened this issue Dec 22, 2023 · 3 comments
Labels
bug Something isn't working RTK-Query

Comments

@saibs
Copy link

saibs commented Dec 22, 2023

On redux toolkit 1.9.2, resetApiState resets the hooks local state.
After upgrading to toolkit to 2.0.1 we found an issue in our app relating to resetApiState call is not resetting the local state of the hook

Sandbox using toolkit 1.9.2
Sandbox using toolkit 2.0.1

Reproduction steps:

  • Click on login button
  • In the next screen you should see
image - Click logout

Result in 1.9.2
image

Result in 2.0.1 - this is a bug
image

@markerikson markerikson added bug Something isn't working RTK-Query labels Feb 5, 2024 — with Volta.net
@Luk-z
Copy link
Contributor

Luk-z commented Feb 11, 2025

Hi guys, me too. This is the code to reproduce the bug. If you press on "reset api" button restApiState is called but data still remain populated. isUnitialized is setted to true correctly.

I'm using the latest version, with the previous major version it is working.

https://playcode.io/2255811

Please give some update!

@Luk-z
Copy link
Contributor

Luk-z commented Mar 17, 2025

@markerikson any update on this issue? currently we wrap each api in a custom hook checking isUninitialized and forcing data undefined if isUninitialized=true...

Luk-z added a commit to Luk-z/redux-toolkit that referenced this issue Mar 17, 2025
@Luk-z
Copy link
Contributor

Luk-z commented Mar 17, 2025

maybe this fix the problem #4896

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working RTK-Query
Projects
None yet
Development

No branches or pull requests

3 participants