Comment by Fudgel
1 year ago
Pretty neat. I think I found a small UI glitch: If I search and then click the browser back button when I'm on the results page, the search button on the home page shows the spinning icon.
1 year ago
Pretty neat. I think I found a small UI glitch: If I search and then click the browser back button when I'm on the results page, the search button on the home page shows the spinning icon.
Snap! I can't repro this. Which browser are you using?
Firefox (on linux). But it seems to also happen in Chrome. I took a quick screen capture: https://imgur.com/a/jpPtj2f - you can see when I click back, the button shows the spinning icon.
Thanks! I couldn't see it on Chrome due to React Devtools interference.
Turns out the page was ending up in bfcache (https://web.dev/articles/bfcache), which in turn led to the button's loading state being preserved when clicking back. Listening to the `pageshow` event enables one to handle that somewhat gracefully.