From 1c14c610bd2bb86ae328c1c19fbf44b76f29f5f6 Mon Sep 17 00:00:00 2001 From: mkljczk Date: Mon, 10 Mar 2025 14:10:41 +0100 Subject: [PATCH] pl-fe: improve loading state handling Signed-off-by: mkljczk --- packages/pl-fe/src/features/ui/components/action-button.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/pl-fe/src/features/ui/components/action-button.tsx b/packages/pl-fe/src/features/ui/components/action-button.tsx index 7e89840b0..6b65777ed 100644 --- a/packages/pl-fe/src/features/ui/components/action-button.tsx +++ b/packages/pl-fe/src/features/ui/components/action-button.tsx @@ -64,7 +64,7 @@ const ActionButton: React.FC = ({ account, actionType, small }) = const { isLoggedIn, me } = useLoggedIn(); const { follow, unfollow } = useFollow(); - const { relationship } = useRelationship(account.id, { enabled: true }); + const { relationship, isLoading } = useRelationship(account.id, { enabled: true }); const { mutate: authorizeFollowRequest } = useAcceptFollowRequestMutation(account.id); const { mutate: rejectFollowRequest } = useRejectFollowRequestMutation(account.id); @@ -241,6 +241,7 @@ const ActionButton: React.FC = ({ account, actionType, small }) = } if (!relationship) { + if (!isLoading) return null; // Wait until the relationship is loaded return (