Update scroll top state on column mounting (#4276)

master
unarist 7 years ago committed by Eugen Rochko
parent 015269914e
commit 4f2513337f
  1. 7
      app/javascript/mastodon/components/status_list.js

@ -30,8 +30,8 @@ export default class StatusList extends ImmutablePureComponent {
intersectionObserverWrapper = new IntersectionObserverWrapper(); intersectionObserverWrapper = new IntersectionObserverWrapper();
handleScroll = debounce((e) => { handleScroll = debounce(() => {
const { scrollTop, scrollHeight, clientHeight } = e.target; const { scrollTop, scrollHeight, clientHeight } = this.node;
const offset = scrollHeight - scrollTop - clientHeight; const offset = scrollHeight - scrollTop - clientHeight;
this._oldScrollPosition = scrollHeight - scrollTop; this._oldScrollPosition = scrollHeight - scrollTop;
@ -49,6 +49,9 @@ export default class StatusList extends ImmutablePureComponent {
componentDidMount () { componentDidMount () {
this.attachScrollListener(); this.attachScrollListener();
this.attachIntersectionObserver(); this.attachIntersectionObserver();
// Handle initial scroll posiiton
this.handleScroll();
} }
componentDidUpdate (prevProps) { componentDidUpdate (prevProps) {

Loading…
Cancel
Save