Skip to content

Commit

Permalink
fix(1207): filtering string with empty space
Browse files Browse the repository at this point in the history
  • Loading branch information
tplevko authored and lordrip committed Jul 26, 2024
1 parent 01c7f17 commit a5c2d33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions packages/ui/src/components/Form/CustomAutoFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a5c2d33

Please sign in to comment.