apollo-client
apollo-client copied to clipboard
onCompleted type signature does not account for partial data
Issue Description
The current type signature of onCompleted
assumes the result is truthy: https://github.com/apollographql/apollo-client/blob/main/src/react/types/types.ts#L244, but that is not the case if error policy is set to none
.
I'd expect the following and be more defensive regardless of how the configuration is:
export interface BaseMutationOptions {
...
onCompleted?: (data: Partial<TData> | null, clientOptions?: BaseMutationOptions) => void;
...
}
Link to Reproduction
N/A
Reproduction Steps
N/A
Hi @martinjlowm 👋🏻 we're planning on tackling this and other typing issues in the upcoming 3.10 minor release. I'll leave this Issue open so you and anyone else who's interested can track progress :)