mirror of
https://github.com/wassname/talk.git
synced 2026-07-15 11:26:58 +08:00
Adapt auto scroll when loading a permalinked comment
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user