diff --git a/webapp/channels/src/components/admin_console/__snapshots__/message_export_settings.test.jsx.snap b/webapp/channels/src/components/admin_console/__snapshots__/message_export_settings.test.jsx.snap
index 3e5cbacbb9..e44cb8abdf 100644
--- a/webapp/channels/src/components/admin_console/__snapshots__/message_export_settings.test.jsx.snap
+++ b/webapp/channels/src/components/admin_console/__snapshots__/message_export_settings.test.jsx.snap
@@ -72,7 +72,7 @@ exports[`components/MessageExportSettings should match snapshot, disabled, actia
setByEnv={false}
value="01:00"
/>
-
}
id="exportFormat"
- isDisabled={false}
label={
-
}
id="exportFormat"
- isDisabled={false}
label={
-
}
id="exportFormat"
- isDisabled={false}
label={
-
}
id="exportFormat"
- isDisabled={false}
label={
-
-
-
-
}
id="FirstSettings.settingc"
- isDisabled={false}
key="Config_dropdown_FirstSettings.settingc"
label="Setting Three"
onChange={[Function]}
@@ -269,7 +268,7 @@ exports[`components/admin_console/SchemaAdminSettings should match snapshot with
-
}
id="SecondSettings.settingi"
- isDisabled={false}
key="Config_language_SecondSettings.settingi"
label="Setting Nine"
onChange={[Function]}
diff --git a/webapp/channels/src/components/admin_console/custom_plugin_settings/__snapshots__/custom_plugin_settings.test.tsx.snap b/webapp/channels/src/components/admin_console/custom_plugin_settings/__snapshots__/custom_plugin_settings.test.tsx.snap
index efb9159ddc..bfec48a54c 100644
--- a/webapp/channels/src/components/admin_console/custom_plugin_settings/__snapshots__/custom_plugin_settings.test.tsx.snap
+++ b/webapp/channels/src/components/admin_console/custom_plugin_settings/__snapshots__/custom_plugin_settings.test.tsx.snap
@@ -76,7 +76,7 @@ exports[`components/admin_console/CustomPluginSettings should match snapshot wit
}
value={true}
/>
-
}
id="settingc"
- isDisabled={false}
key="testplugin_dropdown_settingc"
label="Setting Three"
onChange={[Function]}
@@ -387,7 +386,7 @@ exports[`components/admin_console/CustomPluginSettings should match snapshot wit
}
value={false}
/>
-
}
id="PluginSettings.Plugins.testplugin.settingc"
- isDisabled={false}
key="testplugin_dropdown_PluginSettings.Plugins.testplugin.settingc"
label="Setting Three"
onChange={[Function]}
diff --git a/webapp/channels/src/components/admin_console/dropdown_setting.tsx b/webapp/channels/src/components/admin_console/dropdown_setting.tsx
index ada42e9b75..0728af1adb 100644
--- a/webapp/channels/src/components/admin_console/dropdown_setting.tsx
+++ b/webapp/channels/src/components/admin_console/dropdown_setting.tsx
@@ -1,8 +1,7 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
-import PropTypes from 'prop-types';
-import React, {PureComponent} from 'react';
+import React, {memo, useCallback, useMemo} from 'react';
import type {ReactNode, ChangeEvent} from 'react';
import type {EmailSettings} from '@mattermost/types/config';
@@ -20,57 +19,49 @@ type Props = {
helpText?: ReactNode;
}
-export default class DropdownSetting extends PureComponent {
- static propTypes = {
- id: PropTypes.string.isRequired,
- values: PropTypes.array.isRequired,
- label: PropTypes.node.isRequired,
- value: PropTypes.string.isRequired,
- onChange: PropTypes.func.isRequired,
- disabled: PropTypes.bool,
- setByEnv: PropTypes.bool.isRequired,
- helpText: PropTypes.node,
- };
+const DropdownSetting = ({
+ id,
+ values,
+ label,
+ value,
+ onChange,
+ disabled = false,
+ setByEnv,
+ helpText,
+}: Props) => {
+ const handleChange = useCallback((e: ChangeEvent) => {
+ onChange(id, e.target.value);
+ }, [onChange, id]);
- static defaultProps = {
- isDisabled: false,
- };
-
- handleChange = (e: ChangeEvent) => {
- this.props.onChange(this.props.id, e.target.value);
- };
-
- render() {
- const options = [];
- for (const {value, text} of this.props.values) {
- options.push(
- ,
- );
- }
-
- return (
-
+ values.map(({value: val, text}) => (
+
- );
- }
-}
+ {text}
+
+ )), [values]);
+
+ return (
+
+
+
+ );
+};
+
+export default memo(DropdownSetting);