mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
HACK: remove jarring scroll when hitting back from topic
This commit is contained in:
parent
fc71662a13
commit
3a9f0445bb
1 changed files with 13 additions and 1 deletions
|
@ -186,7 +186,9 @@ Ember.DiscourseLocation = Ember.Object.extend({
|
||||||
if (self.getURL() === self._previousURL) { return; }
|
if (self.getURL() === self._previousURL) { return; }
|
||||||
}
|
}
|
||||||
var url = self.getURL();
|
var url = self.getURL();
|
||||||
popstateCallbacks.forEach(function(cb) { cb(url); });
|
popstateCallbacks.forEach(function(cb) {
|
||||||
|
cb(url);
|
||||||
|
});
|
||||||
callback(url);
|
callback(url);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -226,6 +228,16 @@ Ember.CloakedCollectionView.reopen({
|
||||||
_watchForPopState: function() {
|
_watchForPopState: function() {
|
||||||
var self = this,
|
var self = this,
|
||||||
cb = function() {
|
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.cleanUp();
|
||||||
self.set('controller.postStream.loaded', false);
|
self.set('controller.postStream.loaded', false);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue