TanStackT
TanStack3y ago
5 replies
awake-maroon

Invalidate query in react native

Using an infinite query in react native. One screen has

useInfiniteQuery({
    queryKey: ['posts', user.uid]
...


On another screen I allow the user to update their profile picture. After the image is uploaded I run

queryClient.invalidateQueries({ queryKey: [user.uid] })


To invalidate all queries related to that user (i.e. posts, comments, etc that would all have the profile picture associated with them) . This however is not causing my list of posts to update when I return to the screen. Only after I refresh (which triggers a re-fetch manually) will it update the posts.

Why might this be?
Was this page helpful?