From de05aceb9f9e4fa334a7b503c179a91d6c283516 Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 19 Oct 2024 09:07:01 +0100 Subject: [PATCH] fix these showing when they shouldn't --- projects/website/src/components/friend/add-friend.tsx | 5 +++++ projects/website/src/components/player/claim-profile.tsx | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/projects/website/src/components/friend/add-friend.tsx b/projects/website/src/components/friend/add-friend.tsx index 61e6fb8..96d88ad 100644 --- a/projects/website/src/components/friend/add-friend.tsx +++ b/projects/website/src/components/friend/add-friend.tsx @@ -36,6 +36,11 @@ export default function AddFriend({ player }: Props) { }); } + // Database is not ready + if (settings == undefined || database == undefined) { + return null; + } + // If the player is already a friend, don't show the button if (isFriend || settings?.playerId == id) { return null; diff --git a/projects/website/src/components/player/claim-profile.tsx b/projects/website/src/components/player/claim-profile.tsx index 3921468..444ddbc 100644 --- a/projects/website/src/components/player/claim-profile.tsx +++ b/projects/website/src/components/player/claim-profile.tsx @@ -36,7 +36,12 @@ export default function ClaimProfile({ playerId }: Props) { revalidatePath("/player/[...slug]"); } - if (settings?.playerId == playerId || settings == undefined) { + // Database is not ready + if (settings == undefined || database == undefined) { + return null; + } + + if (settings?.playerId == playerId) { return null; // Don't show the claim button if it's the same user. }