queleok / words-hunter

Basic word game implemented in TS. Rules are simple: get points for composing words from the given set of letters.
https://queleok.github.io/words-hunter/
MIT License
1 stars 0 forks source link

Queueing mechanism does not account for premature restarts #36

Closed queleok closed 3 years ago

queleok commented 3 years ago

Describe the bug At the moment when a new word is entered, it is put in the queue with automatic "visiting" and dequeueing. The "visiting" step is async, and implies possibility of a ~1.5s delay before the attempt to dequeue. Now, if the game is restarted right after the word had been scheduled for "visiting", respective timers and requests will be triggered anyway, and hence when that step is over, an attempt to dequeue will happen even though the new round had already begun (and strictly speaking there should've been a completely new queue object if my hands & head would've been in the right place).

To Reproduce Steps to reproduce the behavior:

  1. Go to the rules.html page and enable the dev tools
  2. Start a new round
  3. Enter some valid word composable from the given set of letters
  4. Before that word is processed, restart the game by pushing the button near the timer

Expected behavior No new messages in the console

Observed behavior A message complaining about an attempt to dequeue empty queue

Additional comments I'm sure more issues could be caused by this... peculiar... design :)