mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-23 14:35:41 +00:00
fix scroll position (#4821)
This commit is contained in:
parent
e0cda4a851
commit
1646f622a5
|
@ -5,6 +5,7 @@ import IntersectionObserverArticle from './intersection_observer_article';
|
||||||
import LoadMore from './load_more';
|
import LoadMore from './load_more';
|
||||||
import IntersectionObserverWrapper from '../features/ui/util/intersection_observer_wrapper';
|
import IntersectionObserverWrapper from '../features/ui/util/intersection_observer_wrapper';
|
||||||
import { throttle } from 'lodash';
|
import { throttle } from 'lodash';
|
||||||
|
import { List as ImmutableList } from 'immutable';
|
||||||
|
|
||||||
export default class ScrollableList extends PureComponent {
|
export default class ScrollableList extends PureComponent {
|
||||||
|
|
||||||
|
@ -95,7 +96,12 @@ export default class ScrollableList extends PureComponent {
|
||||||
|
|
||||||
getFirstChildKey (props) {
|
getFirstChildKey (props) {
|
||||||
const { children } = 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;
|
return firstChild && firstChild.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue