cory2067 / gtsosu

Website for the Global Taiko Showdown series
4 stars 9 forks source link

Timezone gets asked over and over again #200

Open Kasumisama opened 1 month ago

Kasumisama commented 1 month ago

Timezone popup never stops coming up for some reason, this was already reported by overdahedge2014 back in May, and I've noticed it personally happening today, since DST just happened in EU. If anyone could get on looking at this, it would be great, considering that most people will likely be getting this pop up constantly once GTS tourneys start again.

Video showing how it comes up to users below.

https://github.com/user-attachments/assets/6db2bfca-8e5a-4bd9-9407-eb87e6df807d

Chupalika commented 2 weeks ago

I wrote my thoughts in chat while debugging but I'll also document it here in case other ppl see this.

Basically, the app was apparently behaving weirdly for a short period of time?? I was able to recreate the issue to an extent a few days ago. While debugging, I noticed that clicking "Yes" in the popup didn't actually update the app state's user settings, but when I did add code to do that via setUser(), for some reason it still wasn't updating (I checked using console.log()s). I also noticed that the popup component gets re-created every time the page changes, which resets its state, meaning it no longer remembers that the user answered the dialog. I decided to take a break and check again later.

Two days later, I try again, and I couldn't even get the popup to show anymore. I found a line that I missed before localStorage.setItem("suppressedTimezoneUpdate", timezone) which theoretically is supposed to hide the popup forever until the browser timezone changes or the user clears cookies (I think). So I think this part is working now, but wasn't before. Another thing is that the setUser() was now also working properly ????? so I don't know what causes the issue where localStorage and setUser temporarily malfunctions, but at least here is a fix where if one of those is broken then it'll be fine, but I think you will still see the issue if both are broken lol