diff --git a/src/app/tools/ratings/page.tsx b/src/app/tools/ratings/page.tsx index de8a16854..e5f9d510b 100644 --- a/src/app/tools/ratings/page.tsx +++ b/src/app/tools/ratings/page.tsx @@ -29,7 +29,9 @@ import { noArrows } from './page.css'; const ROWS_OPTIONS = [5, 10, 25, 50, 100]; -const useUsernameCache = create>>(() => ({ +type UsernameCache = Record>; + +const useUsernameCache = create(() => ({ asia: {}, com: {}, eu: {}, @@ -124,10 +126,14 @@ export default function Page() { if (ids && ids.length > 0) { getAccountInfo(region, ids).then((data) => { - data.map((player) => { + data.map((player, index) => { useUsernameCache.setState( - produce((draft) => { - draft[region][player.account_id] = player.nickname; + produce((draft: UsernameCache) => { + if (player) { + draft[region][ids[index]] = player.nickname; + } else { + draft[region][ids[index]] = null; + } }), ); }); @@ -432,8 +438,11 @@ export default function Page() { playerSlice?.map((player, index) => ( { position: number; deltaPosition?: number; score: number; @@ -25,9 +26,11 @@ export function Item({ nickname, clan, highlight, + ...props }: ItemProps) { return (