From 62b0e8b407ef99110c64b6bfd24fb53bb1758a23 Mon Sep 17 00:00:00 2001 From: bal7hazar Date: Tue, 17 Dec 2024 17:12:28 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=90=9B=20Fix=20player=20timestamp=20s?= =?UTF-8?q?orting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/profile/src/hooks/achievements.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/profile/src/hooks/achievements.ts b/packages/profile/src/hooks/achievements.ts index be51095f8..2637246e0 100644 --- a/packages/profile/src/hooks/achievements.ts +++ b/packages/profile/src/hooks/achievements.ts @@ -132,13 +132,16 @@ export function useAchievements(accountAddress?: string) { const completion = Object.values(player[achievementId]).every( (task) => task.completion, ); - timestamp = Math.max( - ...Object.values(player[achievementId]).map((task) => task.timestamp), - ); if (completion) { completeds.push(achievementId); stats[achievementId] = stats[achievementId] || 0; stats[achievementId] += 1; + timestamp = Math.max( + timestamp, + ...Object.values(player[achievementId]).map( + (task) => task.timestamp, + ), + ); } return acc + (completion ? trophies[achievementId].earning : 0); }, 0); From f3fb2c7e1fdad844af7ea57d5b2b9e4537f4bd68 Mon Sep 17 00:00:00 2001 From: bal7hazar Date: Tue, 17 Dec 2024 17:14:44 +0100 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=9B=20Add=20missing=20dependencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/profile/src/hooks/achievements.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/profile/src/hooks/achievements.ts b/packages/profile/src/hooks/achievements.ts index 2637246e0..17016f59f 100644 --- a/packages/profile/src/hooks/achievements.ts +++ b/packages/profile/src/hooks/achievements.ts @@ -206,7 +206,13 @@ export function useAchievements(accountAddress?: string) { ); // Update loading state setIsLoading(false); - }, [currentAddress, isFetchingTrophies, isFetchingProgressions]); + }, [ + currentAddress, + isFetchingTrophies, + isFetchingProgressions, + rawTrophies, + rawProgressions, + ]); return { achievements, players, isLoading }; } From dae5fd503b82e1aec4cf9fc71ddc3d199f36a77b Mon Sep 17 00:00:00 2001 From: bal7hazar Date: Tue, 17 Dec 2024 17:15:55 +0100 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=90=9B=20Add=20missing=20useEffect=20?= =?UTF-8?q?dependency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/profile/src/components/achievements/trophies.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/profile/src/components/achievements/trophies.tsx b/packages/profile/src/components/achievements/trophies.tsx index fcde67c60..cc4849cd6 100644 --- a/packages/profile/src/components/achievements/trophies.tsx +++ b/packages/profile/src/components/achievements/trophies.tsx @@ -121,7 +121,7 @@ function Group({ setPages(pages); const page = filtereds.find((a) => !a.completed); setPage(page ? page.index : pages[pages.length - 1]); - }, []); + }, [items]); const handleNext = useCallback(() => { const index = pages.indexOf(page);