From 9991313dabf5ec5d833d2267202e3188ac75d47a Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Fri, 26 Aug 2022 00:26:58 +0100 Subject: [PATCH] fix: remove all instances of isLoading --- client/src/app/pages/ClientFileFlowPage.tsx | 4 +-- client/src/app/pages/OAuth2CallbackPage.tsx | 4 +-- client/src/app/pages/OAuthRequestAuthPage.tsx | 4 +-- client/src/app/pages/VerifyEmailPage.tsx | 4 +-- .../src/app/pages/dashboard/DashboardPage.tsx | 6 ++-- .../games/_game/_playtype/GPTChartPage.tsx | 4 +-- .../_game/_playtype/GPTLeaderboardsPage.tsx | 8 ++--- .../games/_game/_playtype/GPTMainPage.tsx | 12 ++++---- .../games/_game/_playtype/GPTSongsPage.tsx | 4 +-- .../app/pages/dashboard/import/ImportPage.tsx | 4 +-- .../dashboard/users/ARCIntegrationPage.tsx | 4 +-- .../users/FervidexIntegrationPage.tsx | 8 ++--- .../dashboard/users/UserIntegrationsPage.tsx | 12 ++++---- .../pages/dashboard/users/UserInvitesPage.tsx | 8 ++--- .../_game/_playtype/LeaderboardsPage.tsx | 4 +-- .../games/_game/_playtype/ScoresPage.tsx | 30 ++++++++----------- .../games/_game/_playtype/SessionsPage.tsx | 8 ++--- .../_game/_playtype/SpecificSessionPage.tsx | 4 +-- .../_game/_playtype/UGPTSettingsPage.tsx | 10 +++---- .../_playtype/folders/FolderSelectPage.tsx | 4 +-- .../_playtype/folders/FolderTablePage.tsx | 8 ++--- .../_playtype/folders/RecentFoldersPage.tsx | 4 +-- .../_playtype/folders/SpecificFolderPage.tsx | 8 ++--- .../_playtype/rivals/RivalsOverviewPage.tsx | 4 +-- client/src/app/routes/GameRoutes.tsx | 4 +-- client/src/app/routes/UserRoutes.tsx | 12 +++----- .../game/charts/ChartInfoFormat.tsx | 4 +-- .../src/components/imports/ARCImportPage.tsx | 4 +-- client/src/components/imports/ImportInfo.tsx | 4 +-- .../components/imports/KAIIntegrationPage.tsx | 4 +-- .../src/components/sessions/SessionCard.tsx | 4 +-- .../sessions/SessionRaiseBreakdown.tsx | 4 +-- .../tables/dropdowns/PBDropdown.tsx | 11 ++----- .../tables/dropdowns/ScoreDropdown.tsx | 11 ++----- .../dropdowns/components/PlayHistory.tsx | 4 +-- .../src/components/user/UGPTStatContainer.tsx | 4 +-- client/src/components/util/LoadingWrapper.tsx | 4 +-- client/src/components/util/OAuthMoreInfo.tsx | 4 +-- 38 files changed, 108 insertions(+), 140 deletions(-) diff --git a/client/src/app/pages/ClientFileFlowPage.tsx b/client/src/app/pages/ClientFileFlowPage.tsx index 5e022829f..7c3b2e440 100644 --- a/client/src/app/pages/ClientFileFlowPage.tsx +++ b/client/src/app/pages/ClientFileFlowPage.tsx @@ -17,7 +17,7 @@ export default function ClientFileFlowPage() { const { user } = useContext(UserContext); - const { data, isLoading, error } = useApiQuery>( + const { data, error } = useApiQuery>( `/clients/${clientID}` ); @@ -33,7 +33,7 @@ export default function ClientFileFlowPage() { ); } - if (!data || isLoading) { + if (!data) { return ; } diff --git a/client/src/app/pages/OAuth2CallbackPage.tsx b/client/src/app/pages/OAuth2CallbackPage.tsx index d2725173a..504519d6b 100644 --- a/client/src/app/pages/OAuth2CallbackPage.tsx +++ b/client/src/app/pages/OAuth2CallbackPage.tsx @@ -20,7 +20,7 @@ export default function OAuth2CallbackPage({ return ; } - const { data, isLoading, error } = useApiQuery(counterWeight, { + const { data, error } = useApiQuery(counterWeight, { method: "POST", body: JSON.stringify({ code }), headers: { @@ -32,7 +32,7 @@ export default function OAuth2CallbackPage({ ; } - if (isLoading || !data) { + if (!data) { return (
We're checking up with this site to get your authentication sorted. diff --git a/client/src/app/pages/OAuthRequestAuthPage.tsx b/client/src/app/pages/OAuthRequestAuthPage.tsx index 95c3f61f3..a3aed3896 100644 --- a/client/src/app/pages/OAuthRequestAuthPage.tsx +++ b/client/src/app/pages/OAuthRequestAuthPage.tsx @@ -32,7 +32,7 @@ export default function OAuthRequestAuthPage() { } function OAuthRequestAuthLoader({ clientID }: { clientID: string }) { - const { isLoading, error, data } = useApiQuery>( + const { error, data } = useApiQuery>( `/clients/${clientID}` ); @@ -40,7 +40,7 @@ function OAuthRequestAuthLoader({ clientID }: { clientID: string }) { return ; } - if (isLoading || !data) { + if (!data) { return ; } diff --git a/client/src/app/pages/VerifyEmailPage.tsx b/client/src/app/pages/VerifyEmailPage.tsx index 471fdf8db..a0a45ab2c 100644 --- a/client/src/app/pages/VerifyEmailPage.tsx +++ b/client/src/app/pages/VerifyEmailPage.tsx @@ -37,7 +37,7 @@ export default function VerifyEmailPage() { } function VerifyEmail({ code }: { code: string }) { - const { data, isLoading, error } = useApiQuery("/auth/verify-email", { + const { data, error } = useApiQuery("/auth/verify-email", { method: "POST", headers: { "Content-Type": "application/json", @@ -51,7 +51,7 @@ function VerifyEmail({ code }: { code: string }) { return ; } - if (isLoading || !data) { + if (!data) { return ; } diff --git a/client/src/app/pages/dashboard/DashboardPage.tsx b/client/src/app/pages/dashboard/DashboardPage.tsx index ad133ade8..6408e6dcc 100644 --- a/client/src/app/pages/dashboard/DashboardPage.tsx +++ b/client/src/app/pages/dashboard/DashboardPage.tsx @@ -65,15 +65,13 @@ function DashboardLoggedIn({ user }: { user: PublicUserDocument }) { } function RecentInfo({ user }: { user: PublicUserDocument }) { - const { data, isLoading, error } = useApiQuery( - `/users/${user.id}/recent-summary` - ); + const { data, error } = useApiQuery(`/users/${user.id}/recent-summary`); if (error) { return ; } - if (isLoading || !data) { + if (!data) { return ; } diff --git a/client/src/app/pages/dashboard/games/_game/_playtype/GPTChartPage.tsx b/client/src/app/pages/dashboard/games/_game/_playtype/GPTChartPage.tsx index f8fa26207..ec74f30c6 100644 --- a/client/src/app/pages/dashboard/games/_game/_playtype/GPTChartPage.tsx +++ b/client/src/app/pages/dashboard/games/_game/_playtype/GPTChartPage.tsx @@ -89,7 +89,7 @@ function InternalGPTChartPage({ const [mode, setMode] = useState<"leaderboard" | "adjacent">("leaderboard"); - const { data, isLoading, error } = useQuery( + const { data, error } = useQuery( ["PBInfo", `${chart.chartID}`], async () => { const lRes = await APIFetchV1( @@ -132,7 +132,7 @@ function InternalGPTChartPage({ return ; } - if (!data || isLoading) { + if (!data) { return ; } diff --git a/client/src/app/pages/dashboard/games/_game/_playtype/GPTLeaderboardsPage.tsx b/client/src/app/pages/dashboard/games/_game/_playtype/GPTLeaderboardsPage.tsx index 0e796a6aa..6b8bf0653 100644 --- a/client/src/app/pages/dashboard/games/_game/_playtype/GPTLeaderboardsPage.tsx +++ b/client/src/app/pages/dashboard/games/_game/_playtype/GPTLeaderboardsPage.tsx @@ -78,7 +78,7 @@ function ProfileLeaderboard({ game, playtype }: GamePT) { ) : null; - const { data, isLoading, error } = useApiQuery( + const { data, error } = useApiQuery( `/games/${game}/${playtype}/leaderboard?alg=${alg}&limit=500` ); @@ -91,7 +91,7 @@ function ProfileLeaderboard({ game, playtype }: GamePT) { ); } - if (!data || isLoading) { + if (!data) { return ( <> {SelectComponent} @@ -187,7 +187,7 @@ function ScoreLeaderboard({ game, playtype }: GamePT) { ) : null; - const { data, isLoading, error } = useApiQuery( + const { data, error } = useApiQuery( `/games/${game}/${playtype}/score-leaderboard?alg=${alg}` ); @@ -200,7 +200,7 @@ function ScoreLeaderboard({ game, playtype }: GamePT) { ); } - if (!data || isLoading) { + if (!data) { return ( <> {SelectComponent} diff --git a/client/src/app/pages/dashboard/games/_game/_playtype/GPTMainPage.tsx b/client/src/app/pages/dashboard/games/_game/_playtype/GPTMainPage.tsx index 7edeb5d93..c4aa32108 100644 --- a/client/src/app/pages/dashboard/games/_game/_playtype/GPTMainPage.tsx +++ b/client/src/app/pages/dashboard/games/_game/_playtype/GPTMainPage.tsx @@ -74,7 +74,7 @@ export default function GPTMainPage({ game, playtype }: GamePT) { } function RecentAchievedGoalsComponent({ game, playtype }: GamePT) { - const { data, isLoading, error } = useApiQuery<{ + const { data, error } = useApiQuery<{ users: PublicUserDocument[]; goals: GoalDocument[]; goalSubs: GoalSubscriptionDocument[]; @@ -84,7 +84,7 @@ function RecentAchievedGoalsComponent({ game, playtype }: GamePT) { return ; } - if (!data || isLoading) { + if (!data) { return ; } @@ -129,7 +129,7 @@ function RecentAchievedGoalsComponent({ game, playtype }: GamePT) { } function RecentHighlightedScoresComponent({ game, playtype }: GamePT) { - const { data, isLoading, error } = useApiQuery<{ + const { data, error } = useApiQuery<{ scores: ScoreDocument[]; users: PublicUserDocument[]; charts: ChartDocument[]; @@ -140,7 +140,7 @@ function RecentHighlightedScoresComponent({ game, playtype }: GamePT) { return ; } - if (!data || isLoading) { + if (!data) { return ; } @@ -178,7 +178,7 @@ function RecentHighlightedScoresComponent({ game, playtype }: GamePT) { } function RecentClassesComponent({ game, playtype }: GamePT) { - const { data, isLoading, error } = useApiQuery( + const { data, error } = useApiQuery( `/games/${game}/${playtype}/recent-classes` ); @@ -186,7 +186,7 @@ function RecentClassesComponent({ game, playtype }: GamePT) { return ; } - if (!data || isLoading) { + if (!data) { return ; } diff --git a/client/src/app/pages/dashboard/games/_game/_playtype/GPTSongsPage.tsx b/client/src/app/pages/dashboard/games/_game/_playtype/GPTSongsPage.tsx index b9e1e345e..8b48d2bf1 100644 --- a/client/src/app/pages/dashboard/games/_game/_playtype/GPTSongsPage.tsx +++ b/client/src/app/pages/dashboard/games/_game/_playtype/GPTSongsPage.tsx @@ -50,7 +50,7 @@ export default function GPTSongsPage({ game, playtype }: GamePT) { function SearchSongsTable({ game, playtype, search }: { search: string } & GamePT) { const params = new URLSearchParams({ search }); - const { data, isLoading, error } = useApiQuery<{ + const { data, error } = useApiQuery<{ charts: (ChartDocument & { __playcount: integer })[]; songs: SongDocument[]; }>(`/games/${game}/${playtype}/charts${search !== "" ? `?${params.toString()}` : ""}`); @@ -59,7 +59,7 @@ function SearchSongsTable({ game, playtype, search }: { search: string } & GameP return ; } - if (!data || isLoading) { + if (!data) { return ; } diff --git a/client/src/app/pages/dashboard/import/ImportPage.tsx b/client/src/app/pages/dashboard/import/ImportPage.tsx index d45f12c97..3455e13b6 100644 --- a/client/src/app/pages/dashboard/import/ImportPage.tsx +++ b/client/src/app/pages/dashboard/import/ImportPage.tsx @@ -71,7 +71,7 @@ function ShowRecentImports() { } function InnerShowRecentImports({ user }: { user: PublicUserDocument }) { - const { data, error, isLoading } = useApiQuery<{ importType: ImportTypes; count: integer }[]>( + const { data, error } = useApiQuery<{ importType: ImportTypes; count: integer }[]>( `/users/${user.id}/recent-imports` ); @@ -79,7 +79,7 @@ function InnerShowRecentImports({ user }: { user: PublicUserDocument }) { return ; } - if (isLoading || !data) { + if (!data) { return ; } diff --git a/client/src/app/pages/dashboard/users/ARCIntegrationPage.tsx b/client/src/app/pages/dashboard/users/ARCIntegrationPage.tsx index 3d750bb52..0946fd49c 100644 --- a/client/src/app/pages/dashboard/users/ARCIntegrationPage.tsx +++ b/client/src/app/pages/dashboard/users/ARCIntegrationPage.tsx @@ -14,7 +14,7 @@ export default function ARCIntegrationPage({ reqUser }: { reqUser: PublicUserDoc const [iidxID, setIIDXID] = useState(""); const [sdvxID, setSDVXID] = useState(""); - const { data, isLoading, error } = useApiQuery<{ + const { data, error } = useApiQuery<{ iidx: ARCSavedProfileDocument | null; sdvx: ARCSavedProfileDocument | null; }>(`/users/${reqUser.id}/integrations/arc`, undefined, true); @@ -30,7 +30,7 @@ export default function ARCIntegrationPage({ reqUser }: { reqUser: PublicUserDoc return ; } - if (!data || isLoading) { + if (!data) { return ; } diff --git a/client/src/app/pages/dashboard/users/FervidexIntegrationPage.tsx b/client/src/app/pages/dashboard/users/FervidexIntegrationPage.tsx index 1ca6b04d6..b3ef454f0 100644 --- a/client/src/app/pages/dashboard/users/FervidexIntegrationPage.tsx +++ b/client/src/app/pages/dashboard/users/FervidexIntegrationPage.tsx @@ -9,11 +9,7 @@ import { Link } from "react-router-dom"; import { FervidexSettingsDocument, PublicUserDocument } from "tachi-common"; export default function FervidexIntegrationPage({ reqUser }: { reqUser: PublicUserDocument }) { - const { - data: settings, - isLoading, - error, - } = useApiQuery( + const { data: settings, error } = useApiQuery( `/users/${reqUser.id}/integrations/fervidex/settings` ); @@ -21,7 +17,7 @@ export default function FervidexIntegrationPage({ reqUser }: { reqUser: PublicUs return ; } - if (isLoading || settings === undefined) { + if (settings === undefined) { return ; } diff --git a/client/src/app/pages/dashboard/users/UserIntegrationsPage.tsx b/client/src/app/pages/dashboard/users/UserIntegrationsPage.tsx index 6caea62e5..dae7f9f2c 100644 --- a/client/src/app/pages/dashboard/users/UserIntegrationsPage.tsx +++ b/client/src/app/pages/dashboard/users/UserIntegrationsPage.tsx @@ -99,7 +99,7 @@ function OAuthClientPage() { } function OAuthClientInfo() { - const { data, isLoading, error } = useApiQuery("/clients"); + const { data, error } = useApiQuery("/clients"); const [clients, setClients] = useState([]); @@ -111,7 +111,7 @@ function OAuthClientInfo() { return ; } - if (isLoading || !data) { + if (!data) { return ; } @@ -682,7 +682,7 @@ function KAIIntegrationStatus({ kaiType: "flo" | "eag" | "min"; userID: integer; }) { - const { data, isLoading, error } = useApiQuery<{ authStatus: boolean }>( + const { data, error } = useApiQuery<{ authStatus: boolean }>( `/users/${userID}/integrations/kai/${kaiType}` ); @@ -690,7 +690,7 @@ function KAIIntegrationStatus({ return ; } - if (isLoading || !data) { + if (!data) { return ; } @@ -720,7 +720,7 @@ function APIKeysPage({ reqUser }: { reqUser: PublicUserDocument }) { const [apiKeys, setApiKeys] = useState([]); const [showModal, setShowModal] = useState(false); - const { data, isLoading, error } = useApiQuery( + const { data, error } = useApiQuery( `/users/${reqUser.id}/api-tokens` ); @@ -734,7 +734,7 @@ function APIKeysPage({ reqUser }: { reqUser: PublicUserDocument }) { return ; } - if (isLoading || !data) { + if (!data) { return ; } diff --git a/client/src/app/pages/dashboard/users/UserInvitesPage.tsx b/client/src/app/pages/dashboard/users/UserInvitesPage.tsx index 5161f7ef6..fe962d98a 100644 --- a/client/src/app/pages/dashboard/users/UserInvitesPage.tsx +++ b/client/src/app/pages/dashboard/users/UserInvitesPage.tsx @@ -20,7 +20,7 @@ export default function UserInvitesPage({ reqUser }: { reqUser: PublicUserDocume `${reqUser.username}'s Invites` ); - const { data, isLoading, error } = useApiQuery<{ invites: integer; limit: integer }>( + const { data, error } = useApiQuery<{ invites: integer; limit: integer }>( `/users/${reqUser.id}/invites/limit` ); @@ -28,7 +28,7 @@ export default function UserInvitesPage({ reqUser }: { reqUser: PublicUserDocume return ; } - if (!data || isLoading) { + if (!data) { return ; } @@ -86,7 +86,7 @@ export default function UserInvitesPage({ reqUser }: { reqUser: PublicUserDocume } function InviteList({ reqUser }: { reqUser: PublicUserDocument }) { - const { data, isLoading, error } = useApiQuery<{ + const { data, error } = useApiQuery<{ invites: InviteCodeDocument[]; consumers: PublicUserDocument[]; }>(`/users/${reqUser.id}/invites`); @@ -95,7 +95,7 @@ function InviteList({ reqUser }: { reqUser: PublicUserDocument }) { return ; } - if (isLoading || !data) { + if (!data) { return ; } diff --git a/client/src/app/pages/dashboard/users/games/_game/_playtype/LeaderboardsPage.tsx b/client/src/app/pages/dashboard/users/games/_game/_playtype/LeaderboardsPage.tsx index c164c52c7..f663e202b 100644 --- a/client/src/app/pages/dashboard/users/games/_game/_playtype/LeaderboardsPage.tsx +++ b/client/src/app/pages/dashboard/users/games/_game/_playtype/LeaderboardsPage.tsx @@ -48,7 +48,7 @@ export default function LeaderboardsPage({ const url = `/users/${reqUser.id}/games/${game}/${playtype}/leaderboard-adjacent?alg=${alg}`; - const { isLoading, error, data } = useQuery( + const { data, error } = useQuery( url, async () => { const res = await APIFetchV1(url); @@ -73,7 +73,7 @@ export default function LeaderboardsPage({ ); return ( - + ); diff --git a/client/src/app/pages/dashboard/users/games/_game/_playtype/ScoresPage.tsx b/client/src/app/pages/dashboard/users/games/_game/_playtype/ScoresPage.tsx index 4cdcb2efa..8fa9a5934 100644 --- a/client/src/app/pages/dashboard/users/games/_game/_playtype/ScoresPage.tsx +++ b/client/src/app/pages/dashboard/users/games/_game/_playtype/ScoresPage.tsx @@ -141,7 +141,7 @@ function AlgSelector({ } function useFetchPBs(url: string, reqUser: PublicUserDocument) { - const { isLoading, error, data } = useQuery(url, async () => { + const { data, error } = useQuery(url, async () => { const res = await APIFetchV1<{ pbs: PBScoreDocument<"iidx:SP">[]; charts: ChartDocument<"iidx:SP">[]; @@ -155,7 +155,7 @@ function useFetchPBs(url: string, reqUser: PublicUserDocument) { return FormatData(res.body.pbs, res.body.songs, res.body.charts, reqUser); }); - return { isLoading, error: error as UnsuccessfulAPIResponse, data }; + return { error: error as UnsuccessfulAPIResponse, data }; } function PBsOverview({ @@ -175,7 +175,7 @@ function PBsOverview({ } & GamePT) { const [search, setSearch] = useState(""); - const { isLoading, error, data } = useFetchPBs(url, reqUser); + const { data, error } = useFetchPBs(url, reqUser); return (
@@ -188,10 +188,7 @@ function PBsOverview({
{search === "" ? ( - + { + const { data, error } = useQuery(url, async () => { const res = await APIFetchV1<{ scores: ScoreDocument[]; charts: ChartDocument[]; @@ -253,7 +250,7 @@ function useFetchScores(url: string, reqUser: PublicUserDocument) { return FormatData(res.body.scores, res.body.songs, res.body.charts, reqUser); }); - return { isLoading, error: error as UnsuccessfulAPIResponse, data }; + return { error: error as UnsuccessfulAPIResponse, data }; } function PBsSearch({ @@ -267,13 +264,13 @@ function PBsSearch({ search: string; alg?: ScoreCalculatedDataLookup[IDStrings]; } & GamePT) { - const { isLoading, error, data } = useFetchPBs( + const { data, error } = useFetchPBs( `/users/${reqUser.id}/games/${game}/${playtype}/pbs?search=${search}`, reqUser ); return ( - +
{search === "" ? ( - + ) : ( @@ -324,13 +318,13 @@ function ScoresSearch({ playtype, search, }: { reqUser: PublicUserDocument; search: string } & GamePT) { - const { isLoading, error, data } = useFetchScores( + const { data, error } = useFetchScores( `/users/${reqUser.id}/games/${game}/${playtype}/scores?search=${search}`, reqUser ); return ( - + ); diff --git a/client/src/app/pages/dashboard/users/games/_game/_playtype/SessionsPage.tsx b/client/src/app/pages/dashboard/users/games/_game/_playtype/SessionsPage.tsx index 4d1188d61..269c7f8b7 100644 --- a/client/src/app/pages/dashboard/users/games/_game/_playtype/SessionsPage.tsx +++ b/client/src/app/pages/dashboard/users/games/_game/_playtype/SessionsPage.tsx @@ -42,7 +42,7 @@ export default function SessionsPage({ const rating = useSessionRatingAlg(game, playtype); - const { isLoading, error, data } = useQuery( + const { data, error } = useQuery( `${baseUrl}/${sessionSet}`, async () => { const res = await APIFetchV1(`${baseUrl}/${sessionSet}`); @@ -93,7 +93,7 @@ export default function SessionsPage({
{search === "" ? ( - + ( + const { data, error } = useQuery( `${baseUrl}?search=${search}`, async () => { const res = await APIFetchV1(`${baseUrl}?search=${search}`); @@ -136,7 +136,7 @@ function SearchSessionsTable({ ); return ( - + (); - const { data, isLoading, error } = useApiQuery(`/sessions/${sessionID}`); + const { data, error } = useApiQuery(`/sessions/${sessionID}`); if (error) { return ; } - if (isLoading || !data) { + if (!data) { return ; } diff --git a/client/src/app/pages/dashboard/users/games/_game/_playtype/UGPTSettingsPage.tsx b/client/src/app/pages/dashboard/users/games/_game/_playtype/UGPTSettingsPage.tsx index 96da23313..2920ef0fd 100644 --- a/client/src/app/pages/dashboard/users/games/_game/_playtype/UGPTSettingsPage.tsx +++ b/client/src/app/pages/dashboard/users/games/_game/_playtype/UGPTSettingsPage.tsx @@ -113,17 +113,15 @@ function PreferencesForm({ reqUser, game, playtype }: Props) { }, }); - const { - data: tables, - isLoading, - error, - } = useApiQuery(`/games/${game}/${playtype}/tables?showInactive=true`); + const { data: tables, error } = useApiQuery( + `/games/${game}/${playtype}/tables?showInactive=true` + ); if (error) { return ; } - if (isLoading || !tables) { + if (!tables) { return ; } diff --git a/client/src/app/pages/dashboard/users/games/_game/_playtype/folders/FolderSelectPage.tsx b/client/src/app/pages/dashboard/users/games/_game/_playtype/folders/FolderSelectPage.tsx index 4ec68b663..74ca2466a 100644 --- a/client/src/app/pages/dashboard/users/games/_game/_playtype/folders/FolderSelectPage.tsx +++ b/client/src/app/pages/dashboard/users/games/_game/_playtype/folders/FolderSelectPage.tsx @@ -24,7 +24,7 @@ export default function FoldersSearch({ reqUser, game, playtype }: Props) { const params = useMemo(() => new URLSearchParams({ search }), [search]); - const { data, isLoading, error } = useApiQuery( + const { data, error } = useApiQuery( `/users/${reqUser.id}/games/${game}/${playtype}/folders?${params.toString()}` ); @@ -32,7 +32,7 @@ export default function FoldersSearch({ reqUser, game, playtype }: Props) { if (error) { body = <>{error.description}; - } else if (isLoading || !data) { + } else if (!data) { body = ; } else { const statMap = new Map(); diff --git a/client/src/app/pages/dashboard/users/games/_game/_playtype/folders/FolderTablePage.tsx b/client/src/app/pages/dashboard/users/games/_game/_playtype/folders/FolderTablePage.tsx index c57dec95f..2c61b145c 100644 --- a/client/src/app/pages/dashboard/users/games/_game/_playtype/folders/FolderTablePage.tsx +++ b/client/src/app/pages/dashboard/users/games/_game/_playtype/folders/FolderTablePage.tsx @@ -38,7 +38,7 @@ interface Props { } export default function FolderTablePage({ reqUser, game, playtype }: Props) { - const { data, isLoading, error } = useApiQuery( + const { data, error } = useApiQuery( `/games/${game}/${playtype}/tables?showInactive=true` ); @@ -84,7 +84,7 @@ export default function FolderTablePage({ reqUser, game, playtype }: Props) { return ; } - if (isLoading || !data) { + if (!data) { return ; } @@ -125,7 +125,7 @@ interface UGPTFolderStats { } function TableFolderViewer({ reqUser, game, playtype, table }: Props & { table: TableDocument }) { - const { data, isLoading, error } = useApiQuery( + const { data, error } = useApiQuery( `/users/${reqUser.id}/games/${game}/${playtype}/tables/${table.tableID}` ); @@ -153,7 +153,7 @@ function TableFolderViewer({ reqUser, game, playtype, table }: Props & { table: return ; } - if (isLoading || !data || !hasLoadedFolderMap) { + if (!data || !hasLoadedFolderMap) { return ; } diff --git a/client/src/app/pages/dashboard/users/games/_game/_playtype/folders/RecentFoldersPage.tsx b/client/src/app/pages/dashboard/users/games/_game/_playtype/folders/RecentFoldersPage.tsx index adceba08d..b0b1fbfeb 100644 --- a/client/src/app/pages/dashboard/users/games/_game/_playtype/folders/RecentFoldersPage.tsx +++ b/client/src/app/pages/dashboard/users/games/_game/_playtype/folders/RecentFoldersPage.tsx @@ -21,7 +21,7 @@ export default function RecentFoldersPage({ return <>Hey, you're not logged in. How did you get here!; } - const { data, isLoading, error } = useApiQuery<{ + const { data, error } = useApiQuery<{ folders: FolderDocument[]; views: RecentlyViewedFolderDocument[]; stats: FolderStatsInfo[]; @@ -31,7 +31,7 @@ export default function RecentFoldersPage({ return ; } - if (isLoading || !data) { + if (!data) { return ; } diff --git a/client/src/app/pages/dashboard/users/games/_game/_playtype/folders/SpecificFolderPage.tsx b/client/src/app/pages/dashboard/users/games/_game/_playtype/folders/SpecificFolderPage.tsx index 791f6aa80..a690e47f6 100644 --- a/client/src/app/pages/dashboard/users/games/_game/_playtype/folders/SpecificFolderPage.tsx +++ b/client/src/app/pages/dashboard/users/games/_game/_playtype/folders/SpecificFolderPage.tsx @@ -47,7 +47,7 @@ interface Props { export default function SpecificFolderPage({ reqUser, game, playtype }: Props) { const { folderID } = useParams<{ folderID: string }>(); - const { data, isLoading, error } = useApiQuery( + const { data, error } = useApiQuery( `/users/${reqUser.id}/games/${game}/${playtype}/folders/${folderID}` ); @@ -101,7 +101,7 @@ export default function SpecificFolderPage({ reqUser, game, playtype }: Props) { return ; } - if (isLoading || !data || !folderDataset) { + if (!data || !folderDataset) { return ; } @@ -227,7 +227,7 @@ function TimelineMain({ type: "grade" | "lamp"; value: integer; }) { - const { data, isLoading, error } = useApiQuery<{ + const { data, error } = useApiQuery<{ scores: ScoreDocument[]; songs: SongDocument[]; charts: ChartDocument[]; @@ -239,7 +239,7 @@ function TimelineMain({ return ; } - if (isLoading || !data) { + if (!data) { return ; } diff --git a/client/src/app/pages/dashboard/users/games/_game/_playtype/rivals/RivalsOverviewPage.tsx b/client/src/app/pages/dashboard/users/games/_game/_playtype/rivals/RivalsOverviewPage.tsx index 40ab775de..e2647896b 100644 --- a/client/src/app/pages/dashboard/users/games/_game/_playtype/rivals/RivalsOverviewPage.tsx +++ b/client/src/app/pages/dashboard/users/games/_game/_playtype/rivals/RivalsOverviewPage.tsx @@ -23,7 +23,7 @@ export default function RivalsOverviewWrapper({ game: Game; playtype: Playtype; }) { - const { data, isLoading, error } = useApiQuery( + const { data, error } = useApiQuery( `/users/${reqUser.id}/games/${game}/${playtype}/rivals` ); @@ -39,7 +39,7 @@ export default function RivalsOverviewWrapper({ ; } - if (isLoading || !data) { + if (!data) { return ; } diff --git a/client/src/app/routes/GameRoutes.tsx b/client/src/app/routes/GameRoutes.tsx index b83d6cbf2..be57d909c 100644 --- a/client/src/app/routes/GameRoutes.tsx +++ b/client/src/app/routes/GameRoutes.tsx @@ -154,7 +154,7 @@ function GamePlaytypeRoutes({ game }: { game: Game }) { function SongChartRoutes({ game, playtype }: GamePT) { const { songID } = useParams<{ songID: string }>(); - const { data, isLoading, error } = useApiQuery( + const { data, error } = useApiQuery( `/games/${game}/${playtype}/songs/${songID}` ); @@ -172,7 +172,7 @@ function SongChartRoutes({ game, playtype }: GamePT) { return ; } - if (!data || isLoading) { + if (!data) { return ; } diff --git a/client/src/app/routes/UserRoutes.tsx b/client/src/app/routes/UserRoutes.tsx index 2bda0b5f3..80a805afa 100644 --- a/client/src/app/routes/UserRoutes.tsx +++ b/client/src/app/routes/UserRoutes.tsx @@ -44,11 +44,7 @@ export default function UserRoutes() { const { userID } = useParams<{ userID: string }>(); const history = useHistory(); - const { - data: reqUser, - isLoading, - error, - } = useApiQuery(`/users/${params.userID}`); + const { data: reqUser, error } = useApiQuery(`/users/${params.userID}`); const { setBackground } = useContext(BackgroundContext); useEffect(() => { @@ -69,7 +65,7 @@ export default function UserRoutes() { return ; } - if (isLoading || !reqUser) { + if (!reqUser) { return null; } @@ -221,7 +217,7 @@ function UserGamePlaytypeRoutes({ reqUser, game }: { reqUser: PublicUserDocument }; }, [user, game, playtype]); - const { isLoading, error, data } = useQuery>( + const { data, error } = useQuery>( [reqUser.id, game, playtype], async () => { const res = await APIFetchV1( @@ -246,7 +242,7 @@ function UserGamePlaytypeRoutes({ reqUser, game }: { reqUser: PublicUserDocument return ; } - if (isLoading || !data) { + if (!data) { return ; } diff --git a/client/src/components/game/charts/ChartInfoFormat.tsx b/client/src/components/game/charts/ChartInfoFormat.tsx index 4b6b2c2b2..3629db65b 100644 --- a/client/src/components/game/charts/ChartInfoFormat.tsx +++ b/client/src/components/game/charts/ChartInfoFormat.tsx @@ -23,7 +23,7 @@ export default function ChartInfoFormat({ const withTierlists = gptConfig.tierlists.filter((e) => chart.tierlistInfo[e]); - const { data, isLoading, error } = useApiQuery( + const { data, error } = useApiQuery( `/games/${game}/${playtype}/charts/${chart.chartID}/folders` ); @@ -34,7 +34,7 @@ export default function ChartInfoFormat({ ; } - if (!data || isLoading) { + if (!data) { return ; } diff --git a/client/src/components/imports/ARCImportPage.tsx b/client/src/components/imports/ARCImportPage.tsx index 0c1224e42..3b268eb05 100644 --- a/client/src/components/imports/ARCImportPage.tsx +++ b/client/src/components/imports/ARCImportPage.tsx @@ -31,7 +31,7 @@ export default function ARCImportPage({ game }: { game: "sdvx" | "iidx" }) { return <>No user? How did you get here!; } - const { data, isLoading, error } = useApiQuery<{ + const { data, error } = useApiQuery<{ iidx: ARCSavedProfileDocument | null; sdvx: ARCSavedProfileDocument | null; }>(`/users/${user.id}/integrations/arc`); @@ -40,7 +40,7 @@ export default function ARCImportPage({ game }: { game: "sdvx" | "iidx" }) { return ; } - if (!data || isLoading) { + if (!data) { return ; } diff --git a/client/src/components/imports/ImportInfo.tsx b/client/src/components/imports/ImportInfo.tsx index 66f0b877e..3a97a219a 100644 --- a/client/src/components/imports/ImportInfo.tsx +++ b/client/src/components/imports/ImportInfo.tsx @@ -37,7 +37,7 @@ interface Data { } export default function ImportInfo({ importID }: { importID: string }) { - const { data, isLoading, error } = useApiQuery(`/imports/${importID}`); + const { data, error } = useApiQuery(`/imports/${importID}`); const { setUGS } = useContext(UserGameStatsContext); const { user } = useContext(UserContext); @@ -70,7 +70,7 @@ export default function ImportInfo({ importID }: { importID: string }) { ); } - if (isLoading || !data) { + if (!data) { return ( <> diff --git a/client/src/components/imports/KAIIntegrationPage.tsx b/client/src/components/imports/KAIIntegrationPage.tsx index 87c582c41..509684b86 100644 --- a/client/src/components/imports/KAIIntegrationPage.tsx +++ b/client/src/components/imports/KAIIntegrationPage.tsx @@ -36,7 +36,7 @@ export default function KAIIntegrationPage({ clientID, hash, kaiType, redirectUr return ; } - const { isLoading, error, data } = useApiQuery<{ authStatus: boolean }>( + const { data, error } = useApiQuery<{ authStatus: boolean }>( `/users/${user.id}/integrations/kai/${kaiType}` ); @@ -44,7 +44,7 @@ export default function KAIIntegrationPage({ clientID, hash, kaiType, redirectUr return ; } - if (isLoading || !data) { + if (!data) { return ; } diff --git a/client/src/components/sessions/SessionCard.tsx b/client/src/components/sessions/SessionCard.tsx index 22568a5cf..67de81689 100644 --- a/client/src/components/sessions/SessionCard.tsx +++ b/client/src/components/sessions/SessionCard.tsx @@ -22,7 +22,7 @@ import { ScoreDataset } from "types/tables"; export default function SessionCard({ sessionID }: { sessionID: string }) { const { user } = useContext(UserContext); - const { data, isLoading, error } = useApiQuery(`/sessions/${sessionID}`); + const { data, error } = useApiQuery(`/sessions/${sessionID}`); const [highlight, setHighlight] = useState(false); @@ -34,7 +34,7 @@ export default function SessionCard({ sessionID }: { sessionID: string }) { return ; } - if (isLoading || !data) { + if (!data) { return ; } diff --git a/client/src/components/sessions/SessionRaiseBreakdown.tsx b/client/src/components/sessions/SessionRaiseBreakdown.tsx index bc5d7ae1e..29c4d9fd1 100644 --- a/client/src/components/sessions/SessionRaiseBreakdown.tsx +++ b/client/src/components/sessions/SessionRaiseBreakdown.tsx @@ -89,7 +89,7 @@ export default function SessionRaiseBreakdown({ }); }, [folder, tableID, filter]); - const { isLoading, error, data } = useQuery(`/games/${game}/${playtype}/tables`, async () => { + const { data, error } = useQuery(`/games/${game}/${playtype}/tables`, async () => { const res = await APIFetchV1(`/games/${game}/${playtype}/tables`); if (!res.success) { @@ -110,7 +110,7 @@ export default function SessionRaiseBreakdown({ return <>{(error as Error).message}; } - if (isLoading || !data) { + if (!data) { return ; } diff --git a/client/src/components/tables/dropdowns/PBDropdown.tsx b/client/src/components/tables/dropdowns/PBDropdown.tsx index 5a80a70ae..e699edbb9 100644 --- a/client/src/components/tables/dropdowns/PBDropdown.tsx +++ b/client/src/components/tables/dropdowns/PBDropdown.tsx @@ -44,15 +44,11 @@ export default function PBDropdown({ const [view, setView] = useState(defaultView); - const { isLoading, error, data } = useApiQuery>( + const { data, error } = useApiQuery>( `/users/${userID}/games/${game}/${playtype}/pbs/${chart.chartID}?getComposition=true` ); - const { - isLoading: histIsLoading, - error: histError, - data: histData, - } = useApiQuery[]>( + const { error: histError, data: histData } = useApiQuery[]>( `/users/${userID}/games/${game}/${playtype}/scores/${chart.chartID}` ); @@ -88,7 +84,7 @@ export default function PBDropdown({ return ; } - if (isLoading || !data) { + if (!data) { return (
@@ -106,7 +102,6 @@ export default function PBDropdown({ ({ const { user: currentUser } = useContext(UserContext); const { settings } = useContext(UserSettingsContext); - const { isLoading, error, data } = useApiQuery>( + const { data, error } = useApiQuery>( `/users/${user.id}/games/${game}/${playtype}/pbs/${chart.chartID}?getComposition=true` ); - const { - isLoading: histIsLoading, - error: histError, - data: histData, - } = useApiQuery[]>( + const { error: histError, data: histData } = useApiQuery[]>( `/users/${user.id}/games/${game}/${playtype}/scores/${chart.chartID}` ); @@ -75,7 +71,7 @@ export default function ScoreDropdown({ return <>An error has occured. Whoops.; } - if (isLoading || !data) { + if (!data) { return (
@@ -89,7 +85,6 @@ export default function ScoreDropdown({ body = ( {error.description}; } - if (isLoading || !data) { + if (!data) { return ; } diff --git a/client/src/components/user/UGPTStatContainer.tsx b/client/src/components/user/UGPTStatContainer.tsx index bd60e39cf..769772c0b 100644 --- a/client/src/components/user/UGPTStatContainer.tsx +++ b/client/src/components/user/UGPTStatContainer.tsx @@ -33,7 +33,7 @@ export default function UGPTStatContainer({ searchParams.set("gte", stat.gte.toString()); } - const { data, isLoading, error } = useQuery( + const { data, error } = useQuery( `/users/${reqUser.id}/games/${game}/${playtype}/showcase/custom?${searchParams.toString()}`, async () => { const res = await APIFetchV1( @@ -66,7 +66,7 @@ export default function UGPTStatContainer({ return <>{(error as any).description}; } - if (isLoading || !data) { + if (!data) { return ; } diff --git a/client/src/components/util/LoadingWrapper.tsx b/client/src/components/util/LoadingWrapper.tsx index 9b83a29b2..69d668f16 100644 --- a/client/src/components/util/LoadingWrapper.tsx +++ b/client/src/components/util/LoadingWrapper.tsx @@ -4,13 +4,11 @@ import { UnsuccessfulAPIResponse } from "tachi-common"; export default function LoadingWrapper({ dataset, - isLoading, error, children, style, }: { dataset: unknown | null | undefined; - isLoading: boolean; error: UnsuccessfulAPIResponse | null; children: JSX.Element | JSX.Element[]; style?: CSSProperties; @@ -19,7 +17,7 @@ export default function LoadingWrapper({ return

An error has occured. {error.description}

; } - if (isLoading || !dataset) { + if (!dataset) { return ; } diff --git a/client/src/components/util/OAuthMoreInfo.tsx b/client/src/components/util/OAuthMoreInfo.tsx index e93e0f37b..1133d8d4e 100644 --- a/client/src/components/util/OAuthMoreInfo.tsx +++ b/client/src/components/util/OAuthMoreInfo.tsx @@ -10,13 +10,13 @@ export default function OAuthMoreInfo({ }: { client: Omit; }) { - const { data, isLoading, error } = useApiQuery(`/users/${client.author}`); + const { data, error } = useApiQuery(`/users/${client.author}`); if (error) { return ; } - if (isLoading || !data) { + if (!data) { return ; }