boardgameio / boardgame.io

State Management and Multiplayer Networking for Turn-Based Games
https://boardgame.io
MIT License
9.99k stars 704 forks source link

Rooms for different games returned when listing specific game rooms #620

Closed glowacki-dev closed 4 years ago

glowacki-dev commented 4 years ago

There seems to be a bug with listing game rooms when server supports multiple games. There is a room returned for each game type, even though request specifies a game name when fetching rooms.

Steps to reproduce:

  1. Define multiple games
  2. Run application in multiplayer with remote master
  3. Create new room for one of the games (via API or with lobby)

Expected behavior: One new room for selected game is visible.

Actual behavior: New room for every game is visible.

Kapture 2020-04-13 at 14 24 39

Here's the repository with the minimal setup required to reproduce this bug: https://github.com/Bombasarkadian/boardgame.io-multiple-games-bug Run server with node -r esm src/server.js and client with npm start.

EDIT: It seems like the issue is with rooms listing, not rooms creation. I'll prepare a fix soon

cowic commented 4 years ago

I just stumbled about the exact same issue some days ago and tracked it down to

const gameList = await db.listGames(gameName); (in src/server/api.ts line 131)

The contract with db api requires an object with property "gameName" instead of a string. So this line should be: const gameList = await db.listGames({gameName});

oliw commented 4 years ago

Same! Thanks putting the PR out