Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@mantine/core] Autocomplete: fix grouping in Autocomplete #2297

Merged
merged 1 commit into from Aug 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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