From 56961b3b4923258ad8c68905e98a7dc486a6a513 Mon Sep 17 00:00:00 2001 From: Michael <74271024+KvngMikey@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:39:51 +0100 Subject: [PATCH] [MM-60074] Convert ./components/admin_console/multiselect_settings.tsx from Class Component to Function Component (#27908) * feat: convert multiselect_settings to functional component * fix: comments addressed and linting done * fix: failing test --------- Co-authored-by: Mattermost Build --- .../schema_admin_settings.test.tsx.snap | 2 +- .../admin_console/multiselect_settings.tsx | 112 +++++++++--------- 2 files changed, 58 insertions(+), 56 deletions(-) diff --git a/webapp/channels/src/components/admin_console/__snapshots__/schema_admin_settings.test.tsx.snap b/webapp/channels/src/components/admin_console/__snapshots__/schema_admin_settings.test.tsx.snap index 4588d6848d..69cbb55ef4 100644 --- a/webapp/channels/src/components/admin_console/__snapshots__/schema_admin_settings.test.tsx.snap +++ b/webapp/channels/src/components/admin_console/__snapshots__/schema_admin_settings.test.tsx.snap @@ -424,7 +424,7 @@ exports[`components/admin_console/SchemaAdminSettings should match snapshot with ] } /> - text; -export default class MultiSelectSetting extends React.PureComponent< -Props, -State -> { - static defaultProps: Partial = { - disabled: false, - }; +const MultiSelectSetting: React.FC = ({ + id, + values, + label, + selected, + onChange, + disabled = false, + setByEnv, + helpText, + noResultText, +}) => { + const [error, setError] = useState(false); - constructor(props: Props) { - super(props); - - this.state = {error: false}; - } - - handleChange = (newValue: ValueType