pongstylin / tactics

A tactical turn-based board game
The Unlicense
77 stars 23 forks source link

Add game types service #124

Closed AristocattSci closed 11 months ago

AristocattSci commented 1 year ago

See #101 Adds the getGameType service to the GameClient, and the needed backend funcs to handle the request.

Two things: 1: Obviously, any feed back on code style/functionality you would like addressed I can make happen. 2: This change is not ready to actually merge. There is a bug that this change introduces, and it is not clear to me what the intent of how the DOM renders is.

All code referenced below can be found in online.js

Reproduce the bug:

  1. Run locally
  2. Open two browsers and go to the lobby.
  3. Refresh the two browser pages and check the lobby of the other browser. -- You should see that the renderLobby()function is re-running every time you refresh one of the browsers and causing a duplicate of the lobby to show up on the other browser. You can see this happening all the way back at the showTabs() function. Even in the current master branch, you can observeshowTabs()rerunning every time you do the above steps.

Essentially: It's not clear if running showTabs() like this is intended functionality, and that I need to handle my Promises to stop renderLobby() from rendering if it is already rendered Or, if this behavior in showTabs() is not desired, and instead we should prevent any of this stuff from rerendering if it already is rendered.