Skip to content

Commit

Permalink
[@mantine/core] Autocomplete: Fix options grouping with dynamic data (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
achmurali committed Aug 31, 2022
1 parent 4f6ec09 commit 9fcad2e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/mantine-core/src/Autocomplete/Autocomplete.tsx
@@ -1,6 +1,7 @@
import React, { useState, forwardRef, useRef } from 'react';
import { useUncontrolled, useDidUpdate, useMergedRef } from '@mantine/hooks';
import { DefaultProps, getDefaultZIndex } from '@mantine/styles';
import { groupOptions } from '@mantine/utils';
import { Input, InputWrapperBaseProps, InputSharedProps, useInputProps } from '../Input';
import { SelectStylesNames } from '../Select';
import { SelectItems } from '../Select/SelectItems/SelectItems';
Expand Down Expand Up @@ -121,7 +122,9 @@ export const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>((pro
};

const formattedData = data.map((item) => (typeof item === 'string' ? { value: item } : item));
const filteredData = filterData({ data: formattedData, value: _value, limit, filter });
const filteredData = groupOptions({
data: filterData({ data: formattedData, value: _value, limit, filter }),
});

const handleInputKeydown = (event: React.KeyboardEvent<HTMLInputElement>) => {
if (IMEOpen) {
Expand Down

0 comments on commit 9fcad2e

Please sign in to comment.