Skip to content

Commit

Permalink
fix(issue#150): add maxlength on input
Browse files Browse the repository at this point in the history
  • Loading branch information
jufab committed Oct 20, 2023
1 parent 3664f0f commit f396584
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions webapp/src/components/user_selector/autocomplete_selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {FormatOptionLabelContext} from 'react-select/src/Select';
import {getColorStyles, getDescription, getProfilePicture} from '../../utils';

import './autocomplete_selector.scss';
import {components} from 'react-select';

Check failure on line 19 in webapp/src/components/user_selector/autocomplete_selector.tsx

View workflow job for this annotation

GitHub Actions / plugin-ci / lint

`react-select` import should occur before import of `../../utils`

type Props = {
loadOptions: (inputValue: string, callback: ((options: OptionsType<UserProfile>) => void)) => Promise<unknown> | void,
Expand All @@ -30,6 +31,7 @@ type Props = {
theme: Theme,
}


Check failure on line 34 in webapp/src/components/user_selector/autocomplete_selector.tsx

View workflow job for this annotation

GitHub Actions / plugin-ci / lint

More than 1 blank line not allowed
const useTheme = (mattermostTheme: Theme): [StylesConfig, ThemeConfig] => {
const mmColors = getColorStyles(mattermostTheme);

Expand Down Expand Up @@ -116,6 +118,9 @@ export default function AutocompleteSelector(props: Props) {
);
}

//@ts-ignore
const Input = (props) => <components.Input {...props} maxLength={22} />;

Check failure on line 122 in webapp/src/components/user_selector/autocomplete_selector.tsx

View workflow job for this annotation

GitHub Actions / plugin-ci / lint

'props' is already declared in the upper scope

Check failure on line 122 in webapp/src/components/user_selector/autocomplete_selector.tsx

View workflow job for this annotation

GitHub Actions / plugin-ci / lint

Prop `maxLength` must be placed on a new line

Check failure on line 122 in webapp/src/components/user_selector/autocomplete_selector.tsx

View workflow job for this annotation

GitHub Actions / plugin-ci / lint

A space is forbidden before closing bracket

return (
<div
data-testid='autoCompleteSelector'
Expand All @@ -124,6 +129,7 @@ export default function AutocompleteSelector(props: Props) {
{labelContent}
<div className={inputClassName}>
<AsyncSelect
components={{Input}}
autoFocus={Boolean(props.autoFocus)}
cacheOptions={true}
loadOptions={loadOptions}
Expand Down

0 comments on commit f396584

Please sign in to comment.