diff --git a/app/plus/components/PlusVotingPage.tsx b/app/plus/components/PlusVotingPage.tsx index 9aa97b942..3f7dc36c8 100644 --- a/app/plus/components/PlusVotingPage.tsx +++ b/app/plus/components/PlusVotingPage.tsx @@ -46,7 +46,7 @@ export default function PlusVotingPage() { {previousUser ? ( - + {getFullUsername(previousUser)} diff --git a/app/plus/hooks/usePlusVoting.ts b/app/plus/hooks/usePlusVoting.ts index 1a1e87d7d..50d0c30f2 100644 --- a/app/plus/hooks/usePlusVoting.ts +++ b/app/plus/hooks/usePlusVoting.ts @@ -48,9 +48,16 @@ export default function usePlusVoting() { ? (currentIndex / usersForVoting.length) * 100 : undefined, handleVote: (vote: Unpacked>) => { + const nextIndex = currentIndex + 1; setVotes([...votes, vote]); - setCurrentIndex(currentIndex + 1); + setCurrentIndex(nextIndex); (document.activeElement).blur(); + + // preload next avatar + const next = usersForVoting?.[nextIndex + 1]; + if (next) { + new Image().src = `https://cdn.discordapp.com/avatars/${next.discordId}/${next.discordAvatar}.jpg`; + } }, goBack: () => { setVotes(votes.slice(0, votes.length - 1)); diff --git a/components/common/UserAvatar.tsx b/components/common/UserAvatar.tsx index 4fa1e82a2..63b42a69f 100644 --- a/components/common/UserAvatar.tsx +++ b/components/common/UserAvatar.tsx @@ -11,16 +11,22 @@ const UserAvatar: React.FC = ({ user, isSmall, ...props -}) => - user.discordAvatar ? ( - - ) : null; +}) => ( + +); export default UserAvatar;