To me, this falls in the category of bugs I think of as "systemic bugs" or "type bugs". If login components were passed a token, then you could make the token's destructor automatically flag that the process is done. Then this bug would be more-or-less impossible to write.
Because they made it a runtime thing - "components just have to remember to do this", the code structure itself affords this bug.
There was a similar bug at facebook years ago where the user's notification count would say you had notifications - and you click it, and there aren't any notifications. The count was updated by a different code path than the code which inserted notifications in the list, and they got out of sync. They changed the code so both the notification count & list were managed by the same part of the system, and the all instances of the bug went away forever.
For as long as I've used the official app on iOS (since they killed third party apps... which also got me using reddit SIGNIFICANTLY less) it's had the issue where it'll send a push notification for a message reply or whatever, you can click it, view the message in the thread, reply to it, whatever. The push notification will be gone from your iPhone, but it never actually clears the notification from within the app. So you'll still see the notification in your in-app inbox so you have to go in there manually and click it again.
Because they made it a runtime thing - "components just have to remember to do this", the code structure itself affords this bug.
There was a similar bug at facebook years ago where the user's notification count would say you had notifications - and you click it, and there aren't any notifications. The count was updated by a different code path than the code which inserted notifications in the list, and they got out of sync. They changed the code so both the notification count & list were managed by the same part of the system, and the all instances of the bug went away forever.