Open norswap opened 5 months ago
This will also fix another issue that we have:
→ both the joinGame and createModal are displayed, with the createGame modal displaying on top and displaying the option to join the game (even though it's already joined)
Proper redirects as per the above will prevent this from happening.
However it is still abnormal: the createGameModal should autoupdate to detect the game was successfully joined and so not offer to join. That's what the code seems to be doing too, so there's a need to investigate this.
Currently, we fetch the game ID on load from the
inGame
dict which is only populated when effectively joining (not creating) a game.This was by design, as we want to enable a game creator to create multiple games that he may not necessarily participate in (for tournaments, etc).
However, for the current UX flow which assumes 2-player matches where the creator takes part, this is annoying, as the creator can create a game, reload, and lose track of the created game.
This is not fatal (it's still possible to join the previously created game, or create a new one), but for the demo we should store on chain the ID for a created game and fetch.
Probably just populating
inGame
at creation time (and modifying later checks to allow the creator to join) is the way to go for now.