diff --git a/webapp/channels/src/components/sidebar/sidebar_channel/__snapshots__/sidebar_channel.test.tsx.snap b/webapp/channels/src/components/sidebar/sidebar_channel/__snapshots__/sidebar_channel.test.tsx.snap index 055e140935..cdddcb0ec4 100644 --- a/webapp/channels/src/components/sidebar/sidebar_channel/__snapshots__/sidebar_channel.test.tsx.snap +++ b/webapp/channels/src/components/sidebar/sidebar_channel/__snapshots__/sidebar_channel.test.tsx.snap @@ -71,7 +71,7 @@ exports[`components/sidebar/sidebar_channel should match snapshot when GM channe onAnimationStart={[Function]} role="listitem" > - ; - -export default class SidebarGroupChannel extends React.PureComponent { - handleLeaveChannel = (callback: () => void) => { - const id = this.props.channel.id; +const SidebarGroupChannel = ({ + channel, + currentUserId, + actions, + active, + currentTeamName, + redirectChannel, + membersCount, +}: Props) => { + const handleLeaveChannel = useCallback((callback: () => void) => { + const id = channel.id; const category = Constants.Preferences.CATEGORY_GROUP_CHANNEL_SHOW; - const currentUserId = this.props.currentUserId; - this.props.actions.savePreferences(currentUserId, [{user_id: currentUserId, category, name: id, value: 'false'}]).then(callback); + actions.savePreferences(currentUserId, [{user_id: currentUserId, category, name: id, value: 'false'}]).then(callback); trackEvent('ui', 'ui_direct_channel_x_button_clicked'); - if (this.props.active) { - getHistory().push(`/${this.props.currentTeamName}/channels/${this.props.redirectChannel}`); + if (active) { + getHistory().push(`/${currentTeamName}/channels/${redirectChannel}`); } - }; + }, [channel.id, actions, active, currentTeamName, redirectChannel, currentUserId]); - getIcon = () => { + const getIcon = () => { return ( -
{this.props.membersCount}
+
{membersCount}
); }; - render() { - const {channel, currentTeamName} = this.props; + return ( + + ); +}; - return ( - - ); - } -} +export default memo(SidebarGroupChannel);