Adapt auto scroll when loading a permalinked comment

This commit is contained in:
Chi Vinh Le
2017-07-25 19:11:11 +07:00
parent c3bb399782
commit f10d1a9f0d
@@ -3,6 +3,7 @@ import {compose, gql} from 'react-apollo';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import isEqual from 'lodash/isEqual';
import get from 'lodash/get';
import branch from 'recompose/branch';
import renderComponent from 'recompose/renderComponent';
@@ -91,7 +92,7 @@ class EmbedContainer extends React.Component {
}
componentDidUpdate(prevProps) {
if (!prevProps.root.comment && this.props.root.comment) {
if (!get(prevProps, 'root.asset.comment') && get(this.props, 'root.asset.comment')) {
// Scroll to a permalinked comment if one is in the URL once the page is done rendering.
setTimeout(() => pym.scrollParentToChildEl('talk-embed-stream-container'), 0);