Skip to content

Commit b479c05

Browse files
authored
Merge pull request #6182 from ailohq/usemutation-optional-payload-argument
[TypeScript] Fix useMutation requires payload argument
2 parents d21b578 + 5d0cf4e commit b479c05

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/ra-core/src/dataProvider/useMutation.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ const useMutation = (
215215
export interface Mutation {
216216
type: string;
217217
resource?: string;
218-
payload: object;
218+
payload?: object;
219219
}
220220

221221
export interface MutationOptions {
@@ -281,7 +281,12 @@ const mergeDefinitionAndCallTimeParameters = (
281281
callTimeQuery?: Mutation | Event,
282282
options?: MutationOptions,
283283
callTimeOptions?: MutationOptions
284-
) => {
284+
): {
285+
type: string;
286+
resource: string;
287+
payload?: object;
288+
options: MutationOptions;
289+
} => {
285290
if (!query && (!callTimeQuery || callTimeQuery instanceof Event)) {
286291
throw new Error('Missing query either at definition or at call time');
287292
}

0 commit comments

Comments
 (0)