-
Notifications
You must be signed in to change notification settings - Fork 64
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
fix(#150): add maxlength on input #222
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
import {getColorStyles, getDescription, getProfilePicture} from '../../utils'; | ||
|
||
import './autocomplete_selector.scss'; | ||
import {components} from 'react-select'; | ||
|
||
type Props = { | ||
loadOptions: (inputValue: string, callback: ((options: OptionsType<UserProfile>) => void)) => Promise<unknown> | void, | ||
|
@@ -30,6 +31,7 @@ | |
theme: Theme, | ||
} | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Unnecessary extra line here |
||
const useTheme = (mattermostTheme: Theme): [StylesConfig, ThemeConfig] => { | ||
const mmColors = getColorStyles(mattermostTheme); | ||
|
||
|
@@ -116,6 +118,9 @@ | |
); | ||
} | ||
|
||
//@ts-ignore | ||
const Input = (props) => <components.Input {...props} maxLength={22} />; | ||
Check failure on line 122 in webapp/src/components/user_selector/autocomplete_selector.tsx GitHub Actions / plugin-ci / lint
Check failure on line 122 in webapp/src/components/user_selector/autocomplete_selector.tsx GitHub Actions / plugin-ci / lint
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally we don't need to use components={{
Input: (props) => <components.Input {...props} maxLength={22} />,
}} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay then it seems the types for the library don't agree with its supported functionality. Yeah let's just use |
||
|
||
return ( | ||
<div | ||
data-testid='autoCompleteSelector' | ||
|
@@ -124,6 +129,7 @@ | |
{labelContent} | ||
<div className={inputClassName}> | ||
<AsyncSelect | ||
components={{Input}} | ||
autoFocus={Boolean(props.autoFocus)} | ||
cacheOptions={true} | ||
loadOptions={loadOptions} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This import should be further up with the other
react-select
imports. This should really be caught by the linter but I think that rule is not set up for this project