Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Redux Toolkit – Can a state update invalidate RTK Query Data?

We currently have such values set in a settings slice;

settingsSlice: {
  projectId: 'a'
}

The projectId in the example above is used to compose a dynamic URL that an RTK Query API uses for requests, e.g. https://projectId...

Is it possible to invalidate the API data upon a change to the settings slice?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

From the documentation, it seems possible to invalidate other API’s using tags, but that doesn’t seem to be supported within state slices.

>Solution :

No you would have to manually call dispatch(api.invalidateTags(...)).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading