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 committed Jul 26, 2024
1 parent 36e4938 commit 2df8929
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/ui/src/components/Form/CustomAutoFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ 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 === '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 2df8929

Please sign in to comment.