diff --git a/webapp/channels/src/components/channel_header_dropdown/__snapshots__/channel_header_dropdown.test.tsx.snap b/webapp/channels/src/components/channel_header_dropdown/__snapshots__/channel_header_dropdown.test.tsx.snap index b1c1727a7b..4ca71b954f 100644 --- a/webapp/channels/src/components/channel_header_dropdown/__snapshots__/channel_header_dropdown.test.tsx.snap +++ b/webapp/channels/src/components/channel_header_dropdown/__snapshots__/channel_header_dropdown.test.tsx.snap @@ -233,7 +233,7 @@ exports[`components/ChannelHeaderDropdown should match snapshot with no plugin i /> - - + - - - + - + - - - + - + - - + - - + `; @@ -1065,7 +1065,7 @@ exports[`components/ChannelHeaderDropdown should match snapshot with plugins 1`] /> - - + - - - + - + - - - + - + - - + - - + `; diff --git a/webapp/channels/src/components/permissions_gates/channel_permission_gate/__snapshots__/channel_permission_gate.test.tsx.snap b/webapp/channels/src/components/permissions_gates/channel_permission_gate/__snapshots__/channel_permission_gate.test.tsx.snap index 9104ebdd15..12e4fe151a 100644 --- a/webapp/channels/src/components/permissions_gates/channel_permission_gate/__snapshots__/channel_permission_gate.test.tsx.snap +++ b/webapp/channels/src/components/permissions_gates/channel_permission_gate/__snapshots__/channel_permission_gate.test.tsx.snap @@ -13,7 +13,7 @@ exports[`components/permissions_gates ChannelPermissionGate should match snapsho } } > - - - + > +

+ + `; @@ -50,7 +52,7 @@ exports[`components/permissions_gates ChannelPermissionGate should match snapsho } } > - - - + > +

+ + `; @@ -129,7 +133,7 @@ exports[`components/permissions_gates ChannelPermissionGate should match snapsho } } > - - Valid permission (shown)

- - + + `; @@ -170,7 +174,7 @@ exports[`components/permissions_gates ChannelPermissionGate should match snapsho } } > - - - + > +

+ + `; @@ -209,7 +215,7 @@ exports[`components/permissions_gates ChannelPermissionGate should match snapsho } } > - - Valid permission (shown)

- - + + `; @@ -250,7 +256,7 @@ exports[`components/permissions_gates ChannelPermissionGate should match snapsho } } > - - Valid permission (shown)

-
-
+ + `; @@ -291,7 +297,7 @@ exports[`components/permissions_gates ChannelPermissionGate should match snapsho } } > - - Valid permission (shown)

-
-
+ + `; @@ -332,7 +338,7 @@ exports[`components/permissions_gates ChannelPermissionGate should match snapsho } } > - - - + > +

+ + `; @@ -369,7 +377,7 @@ exports[`components/permissions_gates ChannelPermissionGate should match snapsho } } > - - Invalid permission but inverted (shown)

- - + + `; diff --git a/webapp/channels/src/components/permissions_gates/channel_permission_gate/channel_permission_gate.tsx b/webapp/channels/src/components/permissions_gates/channel_permission_gate/channel_permission_gate.tsx index d45f0ff666..27d612a041 100644 --- a/webapp/channels/src/components/permissions_gates/channel_permission_gate/channel_permission_gate.tsx +++ b/webapp/channels/src/components/permissions_gates/channel_permission_gate/channel_permission_gate.tsx @@ -36,16 +36,11 @@ type Props = { children: React.ReactNode; } -export default class ChannelPermissionGate extends React.PureComponent { - render() { - const {hasPermission, children, invert = false} = this.props; - - if (hasPermission && !invert) { - return children; - } - if (!hasPermission && invert) { - return children; - } - return null; +const ChannelPermissionGate = ({hasPermission, children, invert = false}: Props) => { + if (hasPermission !== invert) { + return <>{children}; } -} + return null; +}; + +export default React.memo(ChannelPermissionGate); diff --git a/webapp/channels/src/components/post_view/post_reaction/__snapshots__/post_reaction.test.tsx.snap b/webapp/channels/src/components/post_view/post_reaction/__snapshots__/post_reaction.test.tsx.snap index 2d8894ebe9..d4d371142d 100644 --- a/webapp/channels/src/components/post_view/post_reaction/__snapshots__/post_reaction.test.tsx.snap +++ b/webapp/channels/src/components/post_view/post_reaction/__snapshots__/post_reaction.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/post_view/PostReaction should match snapshot 1`] = ` - - + `; diff --git a/webapp/channels/src/components/post_view/reaction_list/__snapshots__/reactions_list.test.tsx.snap b/webapp/channels/src/components/post_view/reaction_list/__snapshots__/reactions_list.test.tsx.snap index 9d0ee427d1..fe71ea5d0e 100644 --- a/webapp/channels/src/components/post_view/reaction_list/__snapshots__/reactions_list.test.tsx.snap +++ b/webapp/channels/src/components/post_view/reaction_list/__snapshots__/reactions_list.test.tsx.snap @@ -62,7 +62,7 @@ exports[`components/ReactionList should render when there are reactions 1`] = ` target={[Function]} topOffset={-5} /> - - +