Skip to content

Commit 9126559

Browse files
committed
extract data param to defaultData const to avoid a new instance of an array at each render
1 parent b3f48a9 commit 9126559

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { MutationMode } from 'ra-core';
3434
* );
3535
*/
3636
export const BulkUpdateButton = (props: BulkUpdateButtonProps) => {
37-
const { mutationMode = 'undoable', data = [], ...rest } = props;
37+
const { mutationMode = 'undoable', data = defaultData, ...rest } = props;
3838

3939
return mutationMode === 'undoable' ? (
4040
<BulkUpdateWithUndoButton data={data} {...rest} />
@@ -61,3 +61,5 @@ BulkUpdateButton.propTypes = {
6161
mutationMode: PropTypes.oneOf(['pessimistic', 'optimistic', 'undoable']),
6262
icon: PropTypes.element,
6363
};
64+
65+
const defaultData = [];

0 commit comments

Comments
 (0)