diff --git a/client/src/app/pages/dashboard/users/ARCIntegrationPage.tsx b/client/src/app/pages/dashboard/users/ARCIntegrationPage.tsx
index 0946fd49c..e268fe251 100644
--- a/client/src/app/pages/dashboard/users/ARCIntegrationPage.tsx
+++ b/client/src/app/pages/dashboard/users/ARCIntegrationPage.tsx
@@ -17,7 +17,7 @@ export default function ARCIntegrationPage({ reqUser }: { reqUser: PublicUserDoc
const { data, error } = useApiQuery<{
iidx: ARCSavedProfileDocument | null;
sdvx: ARCSavedProfileDocument | null;
- }>(`/users/${reqUser.id}/integrations/arc`, undefined, true);
+ }>(`/users/${reqUser.id}/integrations/arc`, undefined);
useEffect(() => {
if (data) {
diff --git a/client/src/app/pages/dashboard/users/games/_game/_playtype/rivals/RivalsComparePage.tsx b/client/src/app/pages/dashboard/users/games/_game/_playtype/rivals/RivalsComparePage.tsx
index 8a5bd1f99..75cd0e1b1 100644
--- a/client/src/app/pages/dashboard/users/games/_game/_playtype/rivals/RivalsComparePage.tsx
+++ b/client/src/app/pages/dashboard/users/games/_game/_playtype/rivals/RivalsComparePage.tsx
@@ -3,6 +3,7 @@ import useSetSubheader from "components/layout/header/useSetSubheader";
import Divider from "components/util/Divider";
import Icon from "components/util/Icon";
import SelectLinkButton from "components/util/SelectLinkButton";
+import useLUGPTSettings from "components/util/useLUGPTSettings";
import useUGPTBase from "components/util/useUGPTBase";
import React from "react";
import { Col, Row } from "react-bootstrap";
@@ -28,6 +29,12 @@ export default function RivalsComparePage({
const base = `${useUGPTBase({ reqUser, game, playtype })}/rivals/compare`;
+ const { settings } = useLUGPTSettings();
+
+ if (!settings) {
+ return
You have no settings. How did you get here?
;
+ }
+
return (
@@ -63,6 +70,7 @@ export default function RivalsComparePage({
diff --git a/client/src/app/pages/dashboard/users/games/_game/_playtype/rivals/RivalsManagePage.tsx b/client/src/app/pages/dashboard/users/games/_game/_playtype/rivals/RivalsManagePage.tsx
index 2d857089c..b90772aac 100644
--- a/client/src/app/pages/dashboard/users/games/_game/_playtype/rivals/RivalsManagePage.tsx
+++ b/client/src/app/pages/dashboard/users/games/_game/_playtype/rivals/RivalsManagePage.tsx
@@ -33,8 +33,12 @@ export default function RivalsManagePage({
`Managing ${reqUser.username}'s ${FormatGame(game, playtype)} Rivals`
);
+ const { settings } = useLUGPTSettings();
+
const { data, error } = useApiQuery(
- `/users/${reqUser.id}/games/${game}/${playtype}/rivals`
+ `/users/${reqUser.id}/games/${game}/${playtype}/rivals`,
+ {},
+ [`fetch-rivals-${settings?.rivals.join(",")}`]
);
const {
diff --git a/client/src/components/game/ScoreLeaderboard.tsx b/client/src/components/game/ScoreLeaderboard.tsx
index 44b43bdd9..e31b2f7c5 100644
--- a/client/src/components/game/ScoreLeaderboard.tsx
+++ b/client/src/components/game/ScoreLeaderboard.tsx
@@ -25,7 +25,12 @@ const USER_COLOURS = [
COLOUR_SET.orange,
];
-export default function ScoreLeaderboard({ game, playtype, url }: GamePT & { url: string }) {
+export default function ScoreLeaderboard({
+ game,
+ playtype,
+ url,
+ refreshDeps = [],
+}: GamePT & { url: string; refreshDeps?: Array }) {
const gptConfig = GetGamePTConfig(game, playtype);
const defaultAlg = useScoreRatingAlg(game, playtype);
@@ -43,7 +48,11 @@ export default function ScoreLeaderboard({ game, playtype, url }: GamePT & { url
) : null;
- const { data, error } = useApiQuery(`${url}?alg=${alg}`);
+ const { data, error } = useApiQuery(
+ `${url}?alg=${alg}`,
+ {},
+ refreshDeps
+ );
if (error) {
return (
diff --git a/client/src/components/util/query/useApiQuery.tsx b/client/src/components/util/query/useApiQuery.tsx
index 65a6f8013..160899217 100644
--- a/client/src/components/util/query/useApiQuery.tsx
+++ b/client/src/components/util/query/useApiQuery.tsx
@@ -5,10 +5,22 @@ import { SuccessfulAPIResponse } from "tachi-common";
export default function useApiQuery(
url: string | string[],
options?: RequestInit,
- neverCache = false
+ additionalDeps?: string[]
) {
+ const deps = [];
+
+ if (additionalDeps) {
+ deps.push(...additionalDeps);
+ }
+
+ if (Array.isArray(url)) {
+ deps.push(...url);
+ } else {
+ deps.push(url);
+ }
+
return useQuery(
- url,
+ deps,
async () => {
if (Array.isArray(url)) {
const results = await Promise.all(url.map((u) => APIFetchV1(u, options)));