Skip to content
Snippets Groups Projects
Commit 1823cf43 authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

In thread view, only scroll first update, scroll to replied-to post (#5322)

parent 6a50329a
No related branches found
No related tags found
No related merge requests found
......@@ -78,6 +78,7 @@ export default class Status extends ImmutablePureComponent {
componentWillReceiveProps (nextProps) {
if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
this._scrolledIntoView = false;
this.props.dispatch(fetchStatus(nextProps.params.statusId));
}
}
......@@ -240,11 +241,17 @@ export default class Status extends ImmutablePureComponent {
}
componentDidUpdate () {
if (this._scrolledIntoView) {
return;
}
const { status, ancestorsIds } = this.props;
if (status && ancestorsIds && ancestorsIds.size > 0) {
const element = this.node.querySelectorAll('.focusable')[ancestorsIds.size];
element.scrollIntoView();
const element = this.node.querySelectorAll('.focusable')[ancestorsIds.size - 1];
element.scrollIntoView(true);
this._scrolledIntoView = true;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment