From 665a528047360c436ebdfd259c2b74176424f53b Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 4 Jul 2023 01:17:12 -0700 Subject: [PATCH] Properly set and call raidGroups from state Does this fix our bug? We'll find out! --- pages/[username].tsx | 6 ++---- pages/new/index.tsx | 2 +- pages/saved.tsx | 6 ++---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/pages/[username].tsx b/pages/[username].tsx index 945f2b7f..0f39a677 100644 --- a/pages/[username].tsx +++ b/pages/[username].tsx @@ -187,10 +187,8 @@ const ProfileRoute: React.FC = ({ // Fetch all raids on mount, then find the raid in the URL if present useEffect(() => { - api.endpoints.raids.getAll().then((response) => { - const raids = appState.raidGroups.flatMap((group) => group.raids) - setRaids(raids) - }) + const raids = appState.raidGroups.flatMap((group) => group.raids) + setRaids(raids) }, [setRaids]) // When the element, raid or recency filter changes, diff --git a/pages/new/index.tsx b/pages/new/index.tsx index df040d76..b0ecbc0e 100644 --- a/pages/new/index.tsx +++ b/pages/new/index.tsx @@ -109,7 +109,7 @@ const NewRoute: React.FC = ({ useEffect(() => { if (context && context.jobs && context.jobSkills) { - appState.raids = context.raidGroups + appState.raidGroups = context.raidGroups appState.jobs = context.jobs appState.jobSkills = context.jobSkills appState.weaponKeys = context.weaponKeys diff --git a/pages/saved.tsx b/pages/saved.tsx index 84a064ac..4e1d8cc6 100644 --- a/pages/saved.tsx +++ b/pages/saved.tsx @@ -190,10 +190,8 @@ const SavedRoute: React.FC = ({ // Fetch all raids on mount, then find the raid in the URL if present useEffect(() => { - api.endpoints.raids.getAll().then((response) => { - const raids = appState.raidGroups.flatMap((group) => group.raids) - setRaids(raids) - }) + const raids = appState.raidGroups.flatMap((group) => group.raids) + setRaids(raids) }, [setRaids]) // When the element, raid or recency filter changes,