Skip to content

Commit b6037d2

Browse files
committed
Fix side effects
1 parent 8622230 commit b6037d2

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

packages/ra-core/src/controller/button/useUpdateController.tsx

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const useUpdateController = <
6666
): UseUpdateControllerReturn<RecordType> => {
6767
const {
6868
redirect: redirectTo = false,
69-
mutationMode,
69+
mutationMode = 'undoable',
7070
mutationOptions = {},
7171
successMessage,
7272
} = props;
@@ -117,6 +117,8 @@ export const useUpdateController = <
117117
}
118118
);
119119
},
120+
mutationMode,
121+
...otherMutationOptions,
120122
}
121123
);
122124

@@ -127,28 +129,14 @@ export const useUpdateController = <
127129
'The record cannot be updated because no record has been passed'
128130
);
129131
}
130-
updateOne(
131-
resource,
132-
{
133-
id: record.id,
134-
data,
135-
previousData: record,
136-
meta: mutationMeta,
137-
},
138-
{
139-
mutationMode,
140-
...otherMutationOptions,
141-
}
142-
);
132+
updateOne(resource, {
133+
id: record.id,
134+
data,
135+
previousData: record,
136+
meta: mutationMeta,
137+
});
143138
},
144-
[
145-
updateOne,
146-
mutationMeta,
147-
mutationMode,
148-
otherMutationOptions,
149-
record,
150-
resource,
151-
]
139+
[updateOne, mutationMeta, record, resource]
152140
);
153141

154142
return useMemo(

0 commit comments

Comments
 (0)