Mutation on delete not updating `isPending`

We got this query hook:
function useDeleteProjectStageTemplate({
    editMode,
    removeStageTemplate,
    stageTemplateIdx
}: UseDeleteProjectStageTemplateParams) {
    const queryClient = useQueryClient();
    const mutationFn = async (request: RemoveProjectStageTemplateRequest) => {
        try {
            return await stageTemplateApi().removeProjectStageTemplate(request);
        } catch (error) {
            return Promise.reject(error);
        }
    };

    return useMutation({
        mutationFn,
        onSuccess: () => {
            queryClient.invalidateQueries({
                queryKey: ["project-substage-template"]
            });

            if (editMode) {
                return;
            }

            if (removeStageTemplate && stageTemplateIdx != null) {
                removeStageTemplate(stageTemplateIdx);
            }
        }
    });
}


stageTemplateApi().removeProjectStageTemplate(request); response body is empty, and the success status is 200.

when we call this hook in the component like this:
    const {
        mutate: deleteProjectStageTemplate,
        isError: isDeleteProjectStageError,
        isPending: isDeleteProjectStagePending,
        isSuccess: isDeleteProjectStageSuccess,
        status
    } = useDeleteProjectStageTemplate({
        editMode,
        removeStageTemplate,
        stageTemplateIdx
    });


and then run the mutation, the isDeleteProjectStagePending never turns back to
false
, and
status
remain in pending....

what is it?
Was this page helpful?