From 861efb4d5b77642c8e22b2362f08fb8f574b17a2 Mon Sep 17 00:00:00 2001 From: Pedro Tiburcio Date: Mon, 6 Jan 2025 10:26:03 -0500 Subject: [PATCH] fix: PR fixes --- .../FollowToggleButton/index.tsx | 2 +- .../FollowToggleButton/types.ts | 2 +- .../profiles/ProfileComponent/index.tsx | 63 +++++++++---------- 3 files changed, 32 insertions(+), 35 deletions(-) diff --git a/packages/components/modules/profiles/ProfileComponent/FollowToggleButton/index.tsx b/packages/components/modules/profiles/ProfileComponent/FollowToggleButton/index.tsx index 4f8e16d8..1775904c 100644 --- a/packages/components/modules/profiles/ProfileComponent/FollowToggleButton/index.tsx +++ b/packages/components/modules/profiles/ProfileComponent/FollowToggleButton/index.tsx @@ -24,7 +24,7 @@ const FollowToggleButton: FC = ({ const environment = useRelayEnvironment() const toggleFollow = () => { - if (isMutationInFlight || !currentProfileId) { + if (isMutationInFlight || !currentProfileId || !targetId) { return } diff --git a/packages/components/modules/profiles/ProfileComponent/FollowToggleButton/types.ts b/packages/components/modules/profiles/ProfileComponent/FollowToggleButton/types.ts index 380250bb..0cd79e4f 100644 --- a/packages/components/modules/profiles/ProfileComponent/FollowToggleButton/types.ts +++ b/packages/components/modules/profiles/ProfileComponent/FollowToggleButton/types.ts @@ -1,5 +1,5 @@ export interface FollowToggleButtonProps { - targetId: string + targetId?: string isFollowedByMe: boolean | null | undefined currentProfileId?: string profileRef?: any diff --git a/packages/components/modules/profiles/ProfileComponent/index.tsx b/packages/components/modules/profiles/ProfileComponent/index.tsx index 9c070960..e0f93a21 100644 --- a/packages/components/modules/profiles/ProfileComponent/index.tsx +++ b/packages/components/modules/profiles/ProfileComponent/index.tsx @@ -69,42 +69,39 @@ const ProfileComponent: FC = ({ profile: profileRef }) => } const renderProfileUpdatesButtons = () => { - if (profile && currentProfile) { - if (profile.id === currentProfile.id) { - return ( - - ) - } + if (profile?.id === currentProfile?.id) { return ( -
- {!profile?.isBlockedByMe && ( - - )} - {profile?.isBlockedByMe && ( - - )} -
+ ) } - return
+ return ( +
+ {!profile?.isBlockedByMe && ( + + )} + {profile?.isBlockedByMe && ( + + )} +
+ ) } return (