TanStackT
TanStack3y ago
2 replies
opposite-copper

react query cached and not up to date

Hi, I'm using tan stack query for authentication api calling
React router dom for routing
So basically in my auth route I'm logging as a user I'm using use Mutation for calling login api endpoint then redirects to the homepage route which I have a loader calls the api before component load and verify the user credentials with useQuery.

Problem appears if Im deleting credentials it redirects to login page and loggin again with right info the query is still cached with old data. With invalidateQueries isnt working. It only works if I'm refreshing the page again. NOTE query created in the loader function
Was this page helpful?