Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lottery | Draw Tickets sometimes doesn't work #590

Closed
tbstockton opened this issue Oct 12, 2021 · 8 comments · Fixed by #670
Closed

Lottery | Draw Tickets sometimes doesn't work #590

tbstockton opened this issue Oct 12, 2021 · 8 comments · Fixed by #670
Labels

Comments

@tbstockton
Copy link

tbstockton commented Oct 12, 2021

Clicking the Draw Tickets button doesn't appear to update the Progress bar after leaving "Draw Tickets" by clicking on the "Setup" tab and then returning to "Draw Tickets" to draw more tickets. Inconsistent hard to reproduce behavior, almost appears to be long delay.

Doesn't throw an error in the console.

@moveson moveson changed the title Lottery | Draw Tickets Lottery | Draw Tickets sometimes doesn't work Oct 12, 2021
@moveson
Copy link
Collaborator

moveson commented Oct 12, 2021

I was having some similar difficulties this morning (Monday, October 11). For me, the trouble was that one of the test lotteries had more slots than it had entrants to draw, so the "Draw Ticket" button remained enabled even though there was nobody left to draw.

This wouldn't happen in a real lottery where we will have more entrants than slots, but I'd like to address it in any case. The way I'd like to address this is to ensure the "Draw Ticket" button is disabled not only if the lottery is full, but also if all entrants have been drawn.

@tbstockton Is it possible this was what you were experiencing?

@tbstockton
Copy link
Author

@moveson I don't think so. I think I was seeing the 'Newbies' lottery still pulling entrants but the progress bar wasn't updating. This might have been after one of the other lotteries was over full and caused an error? I'll test some more this morning.

@tbstockton
Copy link
Author

tbstockton commented Oct 12, 2021

@moveson
To reproduce I did:
1 - Drew 2 Newbies
2 - Drew 15 Vets (filled it)
3 - Drew 11 Goonies (filled it)
4 - Clicked on "Setup" tab
5 - Clicked on "Draw Tickets" tab
6 - Newbies Draw Ticket wouldn't respond

Contrived I know ...

@moveson
Copy link
Collaborator

moveson commented Oct 12, 2021

Thanks for doing this research, @tbstockton ! I'll see if I can reproduce it on my end.

@moveson
Copy link
Collaborator

moveson commented Oct 13, 2021

I was able to reproduce this. It does not depend on the number of draws or whether a lottery is filled.

The problem seems to occur only when the user switches quickly from Draw Tickets to Setup and back again within a very short period, like under a second. My hypothesis is that when changing back to the Draw Tickets screen, the underlying JS code is attempting to subscribe to the Turbo Streams that make the page work while the JS is still busy unsubscribing from those same streams as a result of switching to the Setup view.

In any case, this is an issue with Turbo, and I've created an issue there describing this problem. See hotwired/turbo#422

@moveson
Copy link
Collaborator

moveson commented Oct 13, 2021

Further research shows that this can occur when switching back and forth from Setup to Draw Tickets even when it's not done very quickly. And once it's a problem, it seems to remain a problem and sometimes gets worse the more switching is done.

A page refresh seems to fix the problem every time. I'm going to try disabling the Turbo Drive feature when switching between these two pages. That will make for slightly less snappy feel when switching, but it may solve this problem.

@moveson
Copy link
Collaborator

moveson commented Oct 13, 2021

#595 appears to have fixed the problem.

@tbstockton Please let me know if you are able to reproduce the problem with this fix in place.

@moveson moveson added the bug label Oct 13, 2021
@moveson
Copy link
Collaborator

moveson commented Oct 14, 2021

We are not the only ones that were experiencing this problem. It was fixed in Rails via a PR that was merged just a few weeks ago: rails/rails#41581

We'll wait for the next Rails version release and then we can upgrade and revisit this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants