diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-07-26 23:35:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-26 23:35:03 +0200 |
commit | 55bee84c97fd662375907520c56fe3a661458e15 (patch) | |
tree | 27ebc452ffdd12b83fd8ddb8de969e196807530b /app/javascript | |
parent | a248be4fcedc2908e4fc073ccea3ee3185264417 (diff) |
Fix infinite scroll fluidity (#4381)
Diffstat (limited to 'app/javascript')
-rw-r--r-- | app/javascript/mastodon/components/status_list.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/javascript/mastodon/components/status_list.js b/app/javascript/mastodon/components/status_list.js index dc6f956bf..48858cf13 100644 --- a/app/javascript/mastodon/components/status_list.js +++ b/app/javascript/mastodon/components/status_list.js @@ -6,7 +6,7 @@ import StatusContainer from '../containers/status_container'; import LoadMore from './load_more'; import ImmutablePureComponent from 'react-immutable-pure-component'; import IntersectionObserverWrapper from '../features/ui/util/intersection_observer_wrapper'; -import { debounce } from 'lodash'; +import { throttle } from 'lodash'; export default class StatusList extends ImmutablePureComponent { @@ -30,13 +30,13 @@ export default class StatusList extends ImmutablePureComponent { intersectionObserverWrapper = new IntersectionObserverWrapper(); - handleScroll = debounce(() => { + handleScroll = throttle(() => { if (this.node) { const { scrollTop, scrollHeight, clientHeight } = this.node; const offset = scrollHeight - scrollTop - clientHeight; this._oldScrollPosition = scrollHeight - scrollTop; - if (250 > offset && this.props.onScrollToBottom && !this.props.isLoading) { + if (400 > offset && this.props.onScrollToBottom && !this.props.isLoading) { this.props.onScrollToBottom(); } else if (scrollTop < 100 && this.props.onScrollToTop) { this.props.onScrollToTop(); @@ -44,7 +44,7 @@ export default class StatusList extends ImmutablePureComponent { this.props.onScroll(); } } - }, 200, { + }, 150, { trailing: true, }); |