about summary refs log tree commit diff
path: root/app/javascript/mastodon/components/scrollable_list.js
diff options
context:
space:
mode:
authorClworld <clworld@ggtea.org>2017-09-07 00:29:56 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-09-06 17:29:56 +0200
commit1646f622a53f0308738c7927ebaaf8d216b69f3e (patch)
treefd2ac165d8967126447957e57ec87657fd682153 /app/javascript/mastodon/components/scrollable_list.js
parente0cda4a851e03e671aaaa81117c615ca6a5be3a8 (diff)
fix scroll position (#4821)
Diffstat (limited to 'app/javascript/mastodon/components/scrollable_list.js')
-rw-r--r--app/javascript/mastodon/components/scrollable_list.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/javascript/mastodon/components/scrollable_list.js b/app/javascript/mastodon/components/scrollable_list.js
index 1a122dbe5..e47b1e9aa 100644
--- a/app/javascript/mastodon/components/scrollable_list.js
+++ b/app/javascript/mastodon/components/scrollable_list.js
@@ -5,6 +5,7 @@ import IntersectionObserverArticle from './intersection_observer_article';
 import LoadMore from './load_more';
 import IntersectionObserverWrapper from '../features/ui/util/intersection_observer_wrapper';
 import { throttle } from 'lodash';
+import { List as ImmutableList } from 'immutable';
 
 export default class ScrollableList extends PureComponent {
 
@@ -95,7 +96,12 @@ export default class ScrollableList extends PureComponent {
 
   getFirstChildKey (props) {
     const { children } = props;
-    const firstChild = Array.isArray(children) ? children[0] : children;
+    let firstChild = children;
+    if (children instanceof ImmutableList) {
+      firstChild = children.get(0);
+    } else if (Array.isArray(children)) {
+      firstChild = children[0];
+    }
     return firstChild && firstChild.key;
   }