Missing queryFn when invalidating
Hey Guys I am getting the missing queryFn warning when I invalidate the query with the refetchType: 'all' param.
1. How I invalidate:
await queryClient.invalidateQueries({
queryKey: [CONSTANTS.API_ROUTES.GET_APTLET_INSTANCE_BY_ID],
refetchType: 'all',
});
2. How I fetch the data:
export const useGetAptletInstanceById = (id) => {
const queryFn = () =>
apiCall({
endpoint: generateApiEndpoint(CONSTANTS.API_ROUTES.GET_APTLET_INSTANCE_BY_ID),
args: { id, decorate: true },
});
return useQuery({
queryKey: [CONSTANTS.API_ROUTES.GET_APTLET_INSTANCE_BY_ID, id],
queryFn,
});
};
Am I missing something?6 Replies
extended-salmon•3y ago
it means you have at least on query in your cache that gets targeted by the invalidation that doesn't have a queryFn set
stormy-goldOP•3y ago
All my queries have a queryFn set 🥲
extended-salmon•3y ago
if they had, you wouldn't see this error 🙂
try reproducing it in a codesandbox, then I can take a look
stormy-goldOP•3y ago
is there a way to find out the location of the missing queryFn? I have searched my project multiple times and have not been able to locate it.
extended-salmon•3y ago
Are you using the devtools?
stormy-goldOP•3y ago
I am using the Flippers React Query Devtools plugin, it's a React Native app @TkDodo 🔮
I am still struggling with the same issue although the invalidation works, it's just annoying...