@@ -67,14 +67,14 @@ export const ReferenceManyField = <
6767) => {
6868 const {
6969 children,
70- filter,
70+ filter = defaultFilter ,
7171 page = 1 ,
7272 pagination = null ,
73- perPage,
73+ perPage = 25 ,
7474 reference,
7575 resource,
76- sort,
77- source,
76+ sort = defaultSort ,
77+ source = 'id' ,
7878 target,
7979 } = props ;
8080 const record = useRecordContext ( props ) ;
@@ -128,21 +128,14 @@ ReferenceManyField.propTypes = {
128128 resource : PropTypes . string ,
129129 sortBy : PropTypes . string ,
130130 sortByOrder : fieldPropTypes . sortByOrder ,
131- source : PropTypes . string . isRequired ,
131+ source : PropTypes . string ,
132132 sort : PropTypes . exact ( {
133133 field : PropTypes . string ,
134134 order : PropTypes . string ,
135135 } ) ,
136136 target : PropTypes . string . isRequired ,
137137} ;
138138
139- ReferenceManyField . defaultProps = {
140- filter : { } ,
141- perPage : 25 ,
142- sort : { field : 'id' , order : 'DESC' } ,
143- source : 'id' ,
144- } ;
145-
146139// FIXME kept for backwards compatibility, unused, to be removed in v5
147140export const ReferenceManyFieldView : FC < ReferenceManyFieldViewProps > = props => {
148141 const { children, pagination } = props ;
@@ -181,3 +174,6 @@ ReferenceManyFieldView.propTypes = {
181174 reference : PropTypes . string ,
182175 setSort : PropTypes . func ,
183176} ;
177+
178+ const defaultFilter = { } ;
179+ const defaultSort = { field : 'id' , order : 'DESC' } ;
0 commit comments