diff --git a/packages/ui/src/components/Form/CustomAutoFields.tsx b/packages/ui/src/components/Form/CustomAutoFields.tsx index 0bace8765..3e7e9b07a 100644 --- a/packages/ui/src/components/Form/CustomAutoFields.tsx +++ b/packages/ui/src/components/Form/CustomAutoFields.tsx @@ -32,10 +32,9 @@ export function CustomAutoFields({ return createElement(element, props, [createElement(autoField!, { key: '', name: '' })]); } + const cleanQueryTerm = filteredFieldText.replace(/\s/g, '').toLowerCase(); const actualFields = (fields ?? schema.getSubfields()).filter( - (field) => - !omitFields!.includes(field) && - (field === 'parameters' || field.toLowerCase().includes(filteredFieldText.toLowerCase())), + (field) => !omitFields!.includes(field) && (field === 'parameters' || field.toLowerCase().includes(cleanQueryTerm)), ); const actualFieldsSchema = actualFields.reduce((acc: { [name: string]: unknown }, name) => { acc[name] = schema.getField(name); diff --git a/packages/ui/src/components/Form/customField/CustomNestField.tsx b/packages/ui/src/components/Form/customField/CustomNestField.tsx index 04790587d..2204dd92f 100644 --- a/packages/ui/src/components/Form/customField/CustomNestField.tsx +++ b/packages/ui/src/components/Form/customField/CustomNestField.tsx @@ -46,8 +46,9 @@ export const CustomNestField = connectField( ...props }: CustomNestFieldProps) => { const { filteredFieldText, isGroupExpanded } = useContext(FilteredFieldContext); + const cleanQueryTerm = filteredFieldText.replace(/\s/g, '').toLowerCase(); const filteredProperties = Object.entries(props.properties ?? {}).filter((field) => - field[0].toLowerCase().includes(filteredFieldText.toLowerCase()), + field[0].toLowerCase().includes(cleanQueryTerm), ); const actualProperties = Object.fromEntries(filteredProperties); const propertiesArray = getFieldGroups(actualProperties);