fix no data error

This commit is contained in:
code002lover 2026-01-19 16:18:31 +01:00
parent c84f617e5c
commit 97ac27e78a
2 changed files with 10 additions and 5 deletions

View File

@ -35,7 +35,11 @@ export function FilteredGamesList({
const positiveCount = gameToPositive.get(game)?.size || 0;
const neutralCount = selectedPeopleCount - positiveCount;
const gameData = games.get(game);
const price = gameData?.price || 0;
if (!gameData) {
console.error("no data", game);
return null;
}
const price = gameData.price;
return (
<Link
@ -81,7 +85,10 @@ export function FilteredGamesList({
padding: "0.2rem 0.6rem",
borderRadius: "4px",
display: "inline-block",
backgroundColor: price === 0 ? "rgba(76, 175, 80, 0.2)" : "rgba(255, 152, 0, 0.2)",
backgroundColor:
price === 0
? "rgba(76, 175, 80, 0.2)"
: "rgba(255, 152, 0, 0.2)",
color: price === 0 ? "#4caf50" : "#ff9800",
fontWeight: 600,
}}

View File

@ -112,9 +112,7 @@ export function useGameFilter(
selectedPeople,
]);
const gamesMap = useMemo(() => {
return new Map(Object.entries(metaDataRef.current));
}, []);
const gamesMap = new Map(Object.entries(metaDataRef.current));
return { filteredGames, gameToPositive: gameToPositiveOpinion, games: gamesMap };
}