Skip to content

Commit

Permalink
fix bug with loading user data for sort if game isn't full
Browse files Browse the repository at this point in the history
  • Loading branch information
mrosack committed Dec 13, 2023
1 parent 54fae68 commit 6ebdc18
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/game/preview/preview.component.ts
Expand Up @@ -116,14 +116,14 @@ export class GamePreviewComponent implements OnChanges {

async loadUsers() {
const userIdsToLoad = this.gamePlayers
.filter(x => !this.userCache.some(y => x.steamId === y.steamId))
.filter(x => !!x && !this.userCache.some(y => x.steamId === y.steamId))
.map(x => x.steamId);

if (userIdsToLoad.length) {
this.userCache.push(...(await this.userApi.byIds(userIdsToLoad.join(",")).toPromise()));
}

return this.gamePlayers.map(x => this.userCache.find(y => x.steamId === y.steamId));
return this.gamePlayers.flatMap(x => (!!x ? this.userCache.filter(y => x.steamId === y.steamId) : []));
}

async startEditingTurnOrder() {
Expand Down

0 comments on commit 6ebdc18

Please sign in to comment.