Skip to content

Commit

Permalink
fix: default players filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Simirall committed Aug 23, 2024
1 parent 9940454 commit b47a48b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/pages/components/GameModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,17 @@ export const GameModal = () => {
const defaultPlayers = useMemo(
() =>
editData?.gameUsers
.filter((u) => (!madamis?.gmRequired ? u : !u.gm))
.filter((u) => {
if (!madamis?.gmRequired) {
if (madamis?.player === editData.gameUsers.length) {
return true;
} else {
return !u.gm;
}
} else {
return !u.gm;
}
})
.map((u) => u.id.toString()) ?? [],
[madamis, editData]
);
Expand Down

0 comments on commit b47a48b

Please sign in to comment.