It happens to me, at least in this site, that sometimes when I press "follow" it glitches to "You’re no longer following this question".
I have to refresh the page to get the expected behaviour.
I can't repro this, and as only one user is reporting this issue, I can't justify the opportunity cost on spending more time on this.
That said, I am kind of baffled as to how this is happening, so will explain some of the code logic, and maybe you will see something on your client side that could help to debug this (or force a repro).
When the follow button is clicked, a function runs on the client side that does (among other things):
PostIdof the question/answer on which it is being run
aria-pressedattribute on the [Follow] button.
truethen it means that you are currently following
falsethen it means that you are not yet following
if (newIsFollowing)(ie: if you are trying to follow something that you weren't following before) then display the "you are now following" popover.
else(ie: you were following, and now you are no longer following) then display the toast info message
So based on what you are writing, you are submitting a request to follow (5.1) and getting the feedback notice from a request to unfollow (5.2). So I am just completely stumped as to how this is happening. I would normally blame a double-submission, but that is hard to do with the button being disabled (unless there is something in your browser that is not observing the
disabled prop on the button), and even so - if you double-submitted and reloaded the page, you would no longer be following.
Would be good to know the value of
aria-pressed on your follow button before you clicked on it, and also to see your network tab to make sure that there is only one ajax call being made.
But like I said, I can't spend more time on this now. Please let me know if something comes up to make the issue more evident.
This has just happened to me on this question https://stackoverflow.com/questions/62117063/how-to-hide-the-div-with-the-form-and-post-data-to-database-and-show-a-hidden-di
I believe it has something to do with the button "Load new answers". When you have the page open and someone adds a new question then the button appears. Once you dynamically load the new answers the "follow" button seems to glitch. Maybe. It could also be caused by dynamically loaded comments under the question.
This post continues in meta: