File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
ra-ui-materialui/src/input Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,10 @@ export const useChoices = ({
5555 const getChoiceText = useCallback (
5656 choice => {
5757 if ( choice ?. id === createValue || choice ?. id === createHintValue ) {
58- // For the create choice, we always use the name prop as text
59- return get ( choice , 'name' ) ;
58+ return get (
59+ choice ,
60+ typeof optionText === 'string' ? optionText : 'name'
61+ ) ;
6062 }
6163
6264 if ( isValidElement < { record : any } > ( optionText ) ) {
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ export const useSupportCreateSuggestion = (
3939 createItemLabel,
4040 createValue = '@@ra-create' ,
4141 createHintValue = '@@ra-create-hint' ,
42+ optionText = 'name' ,
4243 filter,
4344 handleChange,
4445 onCreate,
@@ -61,7 +62,7 @@ export const useSupportCreateSuggestion = (
6162 ? createHintValue
6263 : createValue ,
6364 } ,
64- 'name' ,
65+ typeof optionText === 'string' ? optionText : 'name' ,
6566 filter && createItemLabel
6667 ? translate ( createItemLabel , {
6768 item : filter ,
You can’t perform that action at this time.
0 commit comments