pl-fe: improve loading state handling

Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
mkljczk
2025-03-10 14:10:41 +01:00
parent 1f47cbee22
commit 1c14c610bd

View File

@ -64,7 +64,7 @@ const ActionButton: React.FC<IActionButton> = ({ 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<IActionButton> = ({ account, actionType, small }) =
}
if (!relationship) {
if (!isLoading) return null;
// Wait until the relationship is loaded
return (
<Button