From 4f0cafabcfc393d3d0fc2da3a1bdcbcc53d26f7f Mon Sep 17 00:00:00 2001 From: Chewbacca Date: Wed, 19 Apr 2023 12:40:08 -0400 Subject: [PATCH] Fix logic with toggling Group Tag visibility --- .../features/group/components/group-tag-list-item.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/soapbox/features/group/components/group-tag-list-item.tsx b/app/soapbox/features/group/components/group-tag-list-item.tsx index e4d718695..329913095 100644 --- a/app/soapbox/features/group/components/group-tag-list-item.tsx +++ b/app/soapbox/features/group/components/group-tag-list-item.tsx @@ -41,13 +41,16 @@ const GroupTagListItem = (props: IGroupMemberListItem) => { const isOwner = group.relationship?.role === GroupRoles.OWNER; const toggleVisibility = () => { + const isHiding = tag.visible; + updateGroupTag({ - group_tag_type: tag.visible ? 'hidden' : 'normal', + group_tag_type: isHiding ? 'hidden' : 'normal', }, { onSuccess() { - const entity = { + const entity: GroupTag = { ...tag, visible: !tag.visible, + pinned: isHiding ? false : tag.pinned, // unpin if we're hiding }; dispatch(importEntities([entity], Entities.GROUP_TAGS));