fix: no existing cache overwrites for neighbors

This commit is contained in:
TrèsAbhi committed 2023-11-14 10:29:57 -06:00
1 parent e79c4a1e3f
commit ca8dd5a702
1 file changed
+9 -5
+9 -5
View File
@@ -282,10 +282,14 @@ export default function Page() {
usePlayersCache.setState(
produce((draft: PlayersCache) => {
neighbors.forEach((neighbor) => {
draft[region][season][neighbor.number - 1] = {
id: neighbor.spa_id,
score: neighbor.score,
} satisfies BlitzkriegRatingsLeaderboardEntry;
const position = neighbor.number - 1;
if (!(position in draft[region][season])) {
draft[region][season][position] = {
id: neighbor.spa_id,
score: neighbor.score,
} satisfies BlitzkriegRatingsLeaderboardEntry;
}
});
}),
);
@@ -642,7 +646,7 @@ export default function Page() {
});
cacheNeighbors(
players[region][season][position].id,
ROWS_PER_PAGE * 3,
4 * ROWS_PER_PAGE - 2,
);
}
} else {