Skip to content

Commit 969c0af

Browse files
committed
extract filter and sort param in const to avoid a new instance of a new object at each render
1 parent 9126559 commit 969c0af

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

packages/ra-ui-materialui/src/field/ReferenceManyField.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ export const ReferenceManyField = <
6767
) => {
6868
const {
6969
children,
70-
filter = {},
70+
filter = defaultFilter,
7171
page = 1,
7272
pagination = null,
7373
perPage = 25,
7474
reference,
7575
resource,
76-
sort = { field: 'id', order: 'DESC' },
76+
sort = defaultSort,
7777
source = 'id',
7878
target,
7979
} = props;
@@ -174,3 +174,6 @@ ReferenceManyFieldView.propTypes = {
174174
reference: PropTypes.string,
175175
setSort: PropTypes.func,
176176
};
177+
178+
const defaultFilter = {};
179+
const defaultSort = { field: 'id', order: 'DESC' };

0 commit comments

Comments
 (0)