Skip to content

Commit

Permalink
Fix variant map for games that don't have any variants
Browse files Browse the repository at this point in the history
  • Loading branch information
Perlkonig committed Sep 24, 2024
1 parent 8b25b48 commit 158efeb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/components/ListGames.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ function ListGames({ fixedState }) {
} else {
gameEngine = GameFactory(info.uid);
}
return new Map(gameEngine.allvariants().map((rec) => [rec.uid, rec.name]));
const all = gameEngine.allvariants();
if (all !== undefined) {
return new Map(gameEngine.allvariants().map((rec) => [rec.uid, rec.name]));
} else {
return new Map();
}
}, [metaGame]);

const data = useMemo(
Expand Down
7 changes: 6 additions & 1 deletion src/components/StandingChallenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,12 @@ function StandingChallenges(props) {
} else {
gameEngine = GameFactory(info.uid);
}
return new Map(gameEngine.allvariants().map((rec) => [rec.uid, rec.name]));
const all = gameEngine.allvariants();
if (all !== undefined) {
return new Map(gameEngine.allvariants().map((rec) => [rec.uid, rec.name]));
} else {
return new Map();
}
}, [metaGame]);

const data = useMemo(
Expand Down

0 comments on commit 158efeb

Please sign in to comment.