kaizencc / code-words-game

2 stars 1 forks source link

Make sure refreshing page returns same content #29

Closed kaizencc closed 3 years ago

kaizencc commented 3 years ago

Currently refreshing the page will mess up the state of the game for the user. Need to use sessionStorage and other avenues to ensure that necessary information is saved.

kaizencc commented 3 years ago

Turns out that this issue is a lot bigger than I previously thought. The issue is an old one - refreshing the page disconnects the user from the socket and that calls removePlayerBySocketId, which deletes all the information pertaining to that player (including all statistics).

Storing scores and current display in session storage remains possible and the likely solution there. I believe time can be stored there as well (for now, since this will likely result in some syncing issues). But time is not super essential to the game so that is okay for now.

Steps to fix the pervasive issue: