HACK: remove jarring scroll when hitting back from topic

This commit is contained in:
Sam 2014-08-28 11:57:24 +10:00
parent fc71662a13
commit 3a9f0445bb
1 changed files with 13 additions and 1 deletions

View File

@ -186,7 +186,9 @@ Ember.DiscourseLocation = Ember.Object.extend({
if (self.getURL() === self._previousURL) { return; }
}
var url = self.getURL();
popstateCallbacks.forEach(function(cb) { cb(url); });
popstateCallbacks.forEach(function(cb) {
cb(url);
});
callback(url);
});
},
@ -226,6 +228,16 @@ Ember.CloakedCollectionView.reopen({
_watchForPopState: function() {
var self = this,
cb = function() {
// Sam: This is a hack, but a very important one
// Due to the way we use replace state the back button works strangely
//
// If you visit a topic from the front page, scroll a bit around and then hit back
// you notice that first the page scrolls a bit (within the topic) and then it goes back
// this transition is jarring and adds uneeded rendering costs.
//
// To repro comment the hack out and wack a debugger statement here and in
// topic_route deactivate
$('.posts,#topic-title').hide();
self.cleanUp();
self.set('controller.postStream.loaded', false);
};