Skip to content

Commit 42ba171

Browse files
committed
Re-introduce onSuccess and onError props
1 parent 40a075d commit 42ba171

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@ export const useBulkUpdateController = <
1717
props: UseBulkUpdateControllerParams<RecordType, ErrorType>
1818
): UseBulkUpdateControllerReturn => {
1919
const {
20+
onSuccess,
21+
onError,
2022
mutationMode = 'undoable',
21-
mutationOptions = {},
23+
mutationOptions = {
24+
onSuccess,
25+
onError,
26+
},
2227
successMessage,
2328
} = props;
2429
const { meta: mutationMeta, ...otherMutationOptions } = mutationOptions;
@@ -66,6 +71,7 @@ export const useBulkUpdateController = <
6671
);
6772
refresh();
6873
},
74+
...otherMutationOptions,
6975
}
7076
);
7177

@@ -108,6 +114,10 @@ export interface UseBulkUpdateControllerParams<
108114
RecordType extends RaRecord = any,
109115
MutationOptionsError = unknown,
110116
> {
117+
/* @deprecated use mutationOptions instead */
118+
onSuccess?: () => void;
119+
/* @deprecated use mutationOptions instead */
120+
onError?: (error: any) => void;
111121
mutationMode?: MutationMode;
112122
mutationOptions?: UseUpdateManyOptions<RecordType, MutationOptionsError>;
113123
resource?: string;

packages/ra-ui-materialui/src/button/BulkUpdateWithConfirmButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const sanitizeRestProps = ({
146146
export interface BulkUpdateWithConfirmButtonProps<
147147
RecordType extends RaRecord = any,
148148
MutationOptionsError = unknown,
149-
> extends ButtonProps,
149+
> extends Omit<ButtonProps, 'onError'>,
150150
UseBulkUpdateControllerParams<RecordType, MutationOptionsError> {
151151
confirmContent?: React.ReactNode;
152152
confirmTitle?: React.ReactNode;

packages/ra-ui-materialui/src/button/BulkUpdateWithUndoButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const sanitizeRestProps = ({
6262
export interface BulkUpdateWithUndoButtonProps<
6363
RecordType extends RaRecord = any,
6464
MutationOptionsError = unknown,
65-
> extends ButtonProps,
65+
> extends Omit<ButtonProps, 'onError'>,
6666
Omit<
6767
UseBulkUpdateControllerParams<RecordType, MutationOptionsError>,
6868
'mutationMode'

0 commit comments

Comments
 (0)