bra1n / townsquare

Blood on the Clocktower virtual grimoire & town square
https://clocktower.online
GNU General Public License v3.0
416 stars 234 forks source link

Bug: Nomination logs don't appear to survive a reload #136

Closed langford closed 3 years ago

langford commented 3 years ago

Describe the bug If a player hard reloads the webpage, the nomination log (data) will disappear.

To Reproduce

  1. Start server
  2. Create 5 client windows in separate browsers/etc.
  3. Create game and seat players
  4. Storyteller nominates players, after the clock hand wheels around, hit close
  5. You will see 1 entry show up in each nomination log (open via [v] in versions 2.8 and previous, click icon in 2.9.1 or later)
  6. Any client hard refreshes the page now (Cmd R on safari)
  7. Storyteller initiates another nomination, allows clock hand to wheel round, hit close.
  8. The client that hard refreshed their page has one fewer entries in their nomination log. (So 2 for everyone except the refreshing client, in this example. Refreshing client would have 1 at this point).

Expected behavior I'd expect the nomination log to be synced more completely on a page refresh. I'm not talking about cheat prevention, that's futile in a world with screenshots. I'm just talking "everyone sees the same world".

I think this is especially problematic for the storyteller refreshing, as V/the nomination log indicator do not work if the nomination log length == 0, so they cannot send the "clear nomination log" message as they cannot get to the trash can button. Alternatively, making it so the ST at least can get to the button always would be a very fast fix.

Screenshots Can provide if this isn't obvious when testing #125

Desktop (please complete the following information):

Additional context I thought this was an issue with the nomination icon code, but upon further investigation, the bug predates any edits made to add that.

langford commented 3 years ago

I probably could fix this: I didn't really delve into the data model or history of how/why things were done after I established this behavior predated #125 yet though. I def saw the "infinite loop" prevention stuff and assumed there was a bit of complexity that went beyond the scope of #125.

bra1n commented 3 years ago

This is not a bug but by design. The nomination log is ephemeral as it only tracks nominations that you've "witnessed" and like you said, even the ST will lose the log when they reload the page. I agree that the ST should still be able to clear the log, even after a reload, but for this purpose #121 should already solve that issue as well. So I don't see a need to implement this for now, especially given how contentious the addition of the vote log itself already is.

langford commented 3 years ago

This is wonderful, all the fix with none of the effort. My offer remains open in the future if you need it..