From 4f2513337f77a9f05883b82e5b6a6e3a0dc10b14 Mon Sep 17 00:00:00 2001 From: unarist Date: Thu, 20 Jul 2017 03:26:51 +0900 Subject: [PATCH] Update scroll top state on column mounting (#4276) --- app/javascript/mastodon/components/status_list.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/javascript/mastodon/components/status_list.js b/app/javascript/mastodon/components/status_list.js index 86e8386bd..a8ea1ec5b 100644 --- a/app/javascript/mastodon/components/status_list.js +++ b/app/javascript/mastodon/components/status_list.js @@ -30,8 +30,8 @@ export default class StatusList extends ImmutablePureComponent { intersectionObserverWrapper = new IntersectionObserverWrapper(); - handleScroll = debounce((e) => { - const { scrollTop, scrollHeight, clientHeight } = e.target; + handleScroll = debounce(() => { + const { scrollTop, scrollHeight, clientHeight } = this.node; const offset = scrollHeight - scrollTop - clientHeight; this._oldScrollPosition = scrollHeight - scrollTop; @@ -49,6 +49,9 @@ export default class StatusList extends ImmutablePureComponent { componentDidMount () { this.attachScrollListener(); this.attachIntersectionObserver(); + + // Handle initial scroll posiiton + this.handleScroll(); } componentDidUpdate (prevProps) {