File tree Expand file tree Collapse file tree 2 files changed +3
-7
lines changed
components/grievances/EditPeopleDataChange
shared/Formik/FormikAsyncAutocomplete Expand file tree Collapse file tree 2 files changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -62,11 +62,6 @@ export const EditPeopleDataChangeField = ({
6262 fieldProps = {
6363 component : FormikAsyncAutocomplete ,
6464 restEndpoint : 'adminAreas' ,
65- fetchData : ( data ) =>
66- data ?. results ?. map ( ( area ) => ( {
67- labelEn : `${ area . name } - ${ area . pCode } ` ,
68- value : area . pCode ,
69- } ) ) ,
7065 variables : {
7166 businessArea,
7267 } ,
Original file line number Diff line number Diff line change @@ -26,8 +26,9 @@ export function FormikAsyncAutocomplete({
2626
2727 // Default fetch data function for admin areas
2828 const defaultFetchData = ( data : any ) => {
29- if ( ! data ?. results ) return [ ] ;
30- return data . results . map ( ( area : any ) => ( {
29+ const items = Array . isArray ( data ) ? data : data ?. results ;
30+ if ( ! items ) return [ ] ;
31+ return items . map ( ( area : any ) => ( {
3132 labelEn : `${ area . name } - ${ area . pCode } ` ,
3233 value : area . pCode ,
3334 } ) ) ;
You can’t perform that action at this time.
0 commit comments