From 22820e139e9eb92123cae5cda5cba5b6596c8ab8 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Sat, 14 Oct 2023 10:51:28 +0800 Subject: [PATCH] Move conditional statements in homepage --- src/routes/Home/Home.tsx | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/routes/Home/Home.tsx b/src/routes/Home/Home.tsx index eaa3866..dadb0b2 100644 --- a/src/routes/Home/Home.tsx +++ b/src/routes/Home/Home.tsx @@ -363,22 +363,7 @@ export default function Home() { }); function CustomMap() { - if ( - (StudentStatusQuery.isFetching && studying) || - StudentStatusListQuery.isFetching || - StudyGroupQuery.isFetching || - (StudentStatusQuery.isFetching && !studying) || - StudentStatusListGlobalQuery.isFetching || - StudyGroupGlobalQuery.isFetching - ) { - return ( - <> - - - Loading... - - ); - } else if (!locationPermitted) { + if (!locationPermitted) { console.log(locationPermitted); return ( <> @@ -390,6 +375,22 @@ export default function Home() { ); } else if (dist && location && locationFetched) { if (dist <= 1 || map_distance_override) { + if ( + (StudentStatusQuery.isFetching && studying) || + StudentStatusListQuery.isFetching || + StudyGroupQuery.isFetching || + (StudentStatusQuery.isFetching && !studying) || + StudentStatusListGlobalQuery.isFetching || + StudyGroupGlobalQuery.isFetching + ) { + return ( + <> + + + Loading... + + ); + } return ( <>