-
Hey everyone, Not sure how to title this exactly but I need to invalidate all queryKeys for fetching all conversations ie /conversation/1 The thing is, when I do this like so queryClient.invalidateQueries({
queryKey: [getConversationQueryKey.name],
}); I expect return await queryClient.ensureQueryData(
{
staleTime: 1000 * 60 * 5,
...getConversationOptions({
path: { id: params.conversation_id },
}),
}
); to refetch. But it doesn't. am I doing something wrong? Is that not how queryKey construction work within HeyAPI? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Double check your usage of
queryClient.invalidateQueries({
predicate: (query) =>
query.queryKey[0]._id === getConversationQueryKey()[0]._id // or use the operation id "getConversation" or whatever it happens to be
}) |
Beta Was this translation helpful? Give feedback.
Double check your usage of
getConversationQueryKey
, I believe that should be a function which returns an array, and not an object with a.name
property as you've shown in your example. I don't think it has name at all actually (Unless maybename
comes from the openapi spec and I just don't have them set in my yml)._id
should be consistent between your differentgetConversationOptions
calls, so you can use predicate to invalidate them: