What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

This bug report was marked WONTFIX, and the reason wasn't given. The answer explained how the bug works, but not why it's not getting fixed.

Is it hard to fix? Is it expensive on the server? Anything else?

share|improve this question

2 Answers 2

Well, in layman's terms, when you hit the "Back" button, you're not asking the server for a new page. Instead, you're just merely fetching the source which was downloaded a second ago. There tend to be a few exceptions, such as when the browser has loaded too many pages, but this is how it theoretically works.

Ok, now that you've got that, let me explain that when you cast a vote, you're using Javascript, a bit of interactive code that runs in your browser. When you hit the "Back" button, the Javascript is not run again, unless it's supposed to run for every page load (this isn't—it's only supposed to run when you click on a voting button).

Remember, we can't just store it in a Javascript variable because all the Javascript is dumped and reloaded with each page load (the web is (generally) stateless).

So why is it hard to fix? There are two ways to fix it:

  1. Put in a piece of Javascript that asks the server for the current state of the votes every time the page is loaded (right now—it's sent in the HTML). This is expensive on the database server.

  2. Use cookies/HTML5 Local Storage (or some other browser mechanism) to remember votes and have Javascript check them. While this is possible, it's also a bit of a questionable technique, because the number of votes will accumulate over time. And if we clear them after 5 mins/1 day/1 year, what happens if I start clicking back on my ideal all-remembering browser? I'd get some cases where it remembered my votes, and some cases where it didn't. That creates discrepancy—at least it's consistent right now. The more I think about this, the more I think it might work. Votes shouldn't take that much space—key (with post ID) could fit in 2 bytes, value in 2 bits (1,0,-1), nor should it be too much of a strain on the browser.

share|improve this answer
    
So, it's a bug that we have to live with :( –  Tshepang Feb 4 '11 at 4:00
    
Can you please clarify the first point further? Why would it be expensive for the DB server? Are you implying that each time I refresh a page, I'm accessing fresh DB data? If so, doesn't the DB cache some of this, nullifying the "expensive" argument? Aren't the Back and Forward navigation done far less than fresh page requests? –  Tshepang Feb 4 '11 at 4:04
    
Why would anyone downvote you? Incorrect info? –  Tshepang Feb 4 '11 at 4:06
1  
@Tshepang That's correct, the server would have to do a fresh SQL query each time. I'm not a DBA, so I don't want to go into detail and make a mistake, but what I do know is that before the switchover in search to Lucene, the DB server was heavily stressed, and I suppose every little query saved helped. Of course, now, it might be reconsidered—it's happened before—, but not being a DBA, it could be another reason. As for the downvote, I'm helpless to explain. AFAIK, this is all correct. –  waiwai933 Feb 4 '11 at 4:10
    
Point 2 should work and is worth a feature request, imo. –  Mołot Sep 25 '13 at 13:46

It's not a bug.

When you hit 'back', the browser reloads the page as it was for your last POST to that page. (Or your last 'GET' from that page). Since an ajax vote doesn't refresh the entire page, you're not going to see that vote updated.

It's the way the web works, without it the back button would be useless, because you could never see the state of a page as it was when you first visited it.

share|improve this answer
    
So it becomes one of those "is it a bug or a feature". –  Tshepang Feb 4 '11 at 4:18
1  
Do you seriously prefer the way it currently works? I say this because you say it's not a bug. A bug is something a user finds < ideal. Do you have a different definition? –  Tshepang Feb 4 '11 at 4:20
3  
A bug is not something that is less than ideal. a Bug is a defect in a code or an unexpected user experience outcome. This is not unexpected, it's the way the web has worked since day one. –  George Stocker Feb 4 '11 at 4:23
    
No it isn't! On day one, the web didn't have Javascript! –  Robin Green Apr 18 '11 at 21:24
    
Besides, your answer is technically inaccurate. Frequently the back button does not reset to the initial state of a page, and the main purpose of the back button is not to reset to an initial state. –  Robin Green Apr 18 '11 at 21:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .