-
Greetings all, What happens when multiple queries share the same key in the following cases: 1- When I call queryClient.refetchQueries with this key? Which query will fire? 2- When they return different results with different structures? 3- When they return the same result structure but only partially with some missing fields? Is there a custom result merger option? Many thx in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
queryKeys and queryFn come in pairs. The cache is just a js object where the key of the object is the serialized queryKey, and the value of that entry in the object is the awaited result of the So you can't really have the same key with different query functions that produce different results. If you produce a different result, please use a separate key, as keys have to be unique. |
Beta Was this translation helpful? Give feedback.
queryKeys and queryFn come in pairs. The cache is just a js object where the key of the object is the serialized queryKey, and the value of that entry in the object is the awaited result of the
queryFn
.So you can't really have the same key with different query functions that produce different results. If you produce a different result, please use a separate key, as keys have to be unique.