From 211807f494170a4c432e1fd8099204b84c419fb3 Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 18 Apr 2024 07:59:03 +0100 Subject: [PATCH] fix infinite loading icon when searching for an invalid player --- src/app/(pages)/player/[[...id]]/page.tsx | 2 +- src/app/(pages)/server/[platform]/[[...hostname]]/page.tsx | 2 +- src/app/components/player/lookup-player.tsx | 4 ++-- src/app/components/server/lookup-server.tsx | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/(pages)/player/[[...id]]/page.tsx b/src/app/(pages)/player/[[...id]]/page.tsx index eb1c25b..57ea997 100644 --- a/src/app/(pages)/player/[[...id]]/page.tsx +++ b/src/app/(pages)/player/[[...id]]/page.tsx @@ -69,7 +69,7 @@ export default async function Page({ params: { id } }: Params): PromiseLookup a Player

You can enter a players uuid or username to get information about the player.

- + {error && } diff --git a/src/app/(pages)/server/[platform]/[[...hostname]]/page.tsx b/src/app/(pages)/server/[platform]/[[...hostname]]/page.tsx index 3abba91..ca7bf13 100644 --- a/src/app/(pages)/server/[platform]/[[...hostname]]/page.tsx +++ b/src/app/(pages)/server/[platform]/[[...hostname]]/page.tsx @@ -124,7 +124,7 @@ export default async function Page({ params: { platform, hostname } }: Params):

Lookup a {invalidPlatform ? "" : capitalizeFirstLetter(platform)} Server

You can enter a server hostname to get information about the server.

- + {error && } diff --git a/src/app/components/player/lookup-player.tsx b/src/app/components/player/lookup-player.tsx index f75a94d..9dcaded 100644 --- a/src/app/components/player/lookup-player.tsx +++ b/src/app/components/player/lookup-player.tsx @@ -33,7 +33,7 @@ export function LookupPlayer({ currentPlayer }: PlayerLookupProps): ReactElement } // Ignore the same player - if (query.toLowerCase() == currentPlayer.toLowerCase()) { + if (currentPlayer !== undefined && query.toLowerCase() == currentPlayer.toLowerCase()) { return; } @@ -49,7 +49,7 @@ export function LookupPlayer({ currentPlayer }: PlayerLookupProps): ReactElement description: (err as Error).message, duration: 5000, }); - return; + return setLoading(false); } }; diff --git a/src/app/components/server/lookup-server.tsx b/src/app/components/server/lookup-server.tsx index a5c6fa6..0365b9a 100644 --- a/src/app/components/server/lookup-server.tsx +++ b/src/app/components/server/lookup-server.tsx @@ -57,7 +57,7 @@ export function LookupServer({ currentPlatform, currentServer }: LookupServerPro description: (err as Error).message, duration: 5000, }); - return; + return setLoading(false); } };