The ticket read: "location button sometimes just spins forever." Not a crash, not an error toast — just a spinner that never stopped. QA couldn't reproduce it. It worked every time on the office Wi-Fi, every time on a laptop, every time in the demo to the client.
It only happened out in the field. On a phone. Somewhere the GPS fix took its time and the Wi-Fi-based positioning fallback was slow to answer. Which meant it was exactly the one environment nobody tested in before shipping.
Here's the part that made it worse: the code had an error handler. Both arguments to getCurrentPosition() were filled in, success and failure. By every code-review instinct, this was handled.
The code that looks fully handled
function useMyLocation ( onFound , onFail ) { navigator . geolocation . getCurrentPosition ( ( pos ) => onFound ( pos . coords ), ( err ) => onFail ( err . message ) ); }
Enter fullscreen mode
Exit fullscreen mode
A success callback, an error callback, nothing swallowed.…