Best practice to invalidate useSuspenseQuery
I use tanstack router and try to use the pattern of
ensureQueryData
and useSuspenseQuery
. The query works so far great, but now trying to use queryClient.invaldiateQueries
does not seem to behave the same way useQuery
was working. How would I invalidate client side the useSuspenseQuery
by provided queryKey
?
Thanks4 Replies
other-emerald•13mo ago
Why doesn't it work the same (it should)
cloudy-cyanOP•13mo ago
Oh, thanks for pointing it out! I am using graqhql-codegen with react-query plugin and just realised after you wrote, that the plugin distinct between:
I was using the useUserQuery key on invalidation which is simply wrong key, after updating it everything works as expected. Thanks for clarifying it
other-emerald•13mo ago
always those generators 😅
cloudy-cyanOP•13mo ago
yeah.. its a love-hate relationship.. but I haven't found anything comparable in terms of completeness