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
dependent-tan•16mo ago
Why doesn't it work the same (it should)
rival-blackOP•16mo 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
dependent-tan•16mo ago
always those generators 😅
rival-blackOP•16mo ago
yeah.. its a love-hate relationship.. but I haven't found anything comparable in terms of completeness