FIX: Upwards scrolling was broken in a topic
This commit is contained in:
parent
ea98a4366e
commit
88c104bb83
|
@ -6,6 +6,7 @@ export default Ember.Component.extend({
|
|||
_rootNode: null,
|
||||
_timeout: null,
|
||||
_widgetClass: null,
|
||||
_afterRender: null,
|
||||
|
||||
init() {
|
||||
this._super();
|
||||
|
@ -24,7 +25,11 @@ export default Ember.Component.extend({
|
|||
Ember.run.cancel(this._timeout);
|
||||
},
|
||||
|
||||
queueRerender() {
|
||||
queueRerender(callback) {
|
||||
if (callback && !this._afterRender) {
|
||||
this._afterRender = callback;
|
||||
}
|
||||
|
||||
Ember.run.scheduleOnce('render', this, this.rerenderWidget);
|
||||
},
|
||||
|
||||
|
@ -41,6 +46,11 @@ export default Ember.Component.extend({
|
|||
this._rootNode = patch(this._rootNode, patches);
|
||||
this._tree = newTree;
|
||||
console.log('render: ', new Date().getTime() - t0);
|
||||
|
||||
if (this._afterRender) {
|
||||
this._afterRender();
|
||||
this._afterRender = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ export default MountWidget.extend({
|
|||
const posts = this.posts;
|
||||
if (onscreen.length) {
|
||||
|
||||
const refresh = () => this.queueRerender();
|
||||
const refresh = cb => this.queueRerender(cb);
|
||||
const first = posts.objectAt(onscreen[0]);
|
||||
if (this._topVisible !== first) {
|
||||
this._topVisible = first;
|
||||
|
@ -89,10 +89,8 @@ export default MountWidget.extend({
|
|||
const distToElement = elemPos ? $body.scrollTop() - elemPos.top : 0;
|
||||
|
||||
const topRefresh = () => {
|
||||
refresh();
|
||||
|
||||
Ember.run.next(() => {
|
||||
const $refreshedElem = $(elemId);
|
||||
refresh(() => {
|
||||
const $refreshedElem = $(`#${elemId}`);
|
||||
|
||||
// Quickly going back might mean the element is destroyed
|
||||
const position = $refreshedElem.position();
|
||||
|
|
Loading…
Reference in New Issue