TanStackT
TanStack3y ago
7 replies
brilliant-lime

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?
Was this page helpful?