@@ 217,6 217,7 @@ class Status extends ImmutablePureComponent {
componentDidMount () {
attachFullscreenListener(this.onFullScreenChange);
this.props.dispatch(fetchStatus(this.props.params.statusId));
+ this._scrollStatusIntoView();
}
static getDerivedStateFromProps(props, state) {
@@ 614,10 615,10 @@ class Status extends ImmutablePureComponent {
this.column = c;
};
- componentDidUpdate (prevProps) {
- const { status, ancestorsIds, multiColumn } = this.props;
+ _scrollStatusIntoView () {
+ const { status, multiColumn } = this.props;
- if (status && (ancestorsIds.size > prevProps.ancestorsIds.size || prevProps.status?.get('id') !== status.get('id'))) {
+ if (status) {
window.requestAnimationFrame(() => {
this.node?.querySelector('.detailed-status__wrapper')?.scrollIntoView(true);
@@ 634,6 635,14 @@ class Status extends ImmutablePureComponent {
}
}
+ componentDidUpdate (prevProps) {
+ const { status, ancestorsIds } = this.props;
+
+ if (status && (ancestorsIds.size > prevProps.ancestorsIds.size || prevProps.status?.get('id') !== status.get('id'))) {
+ this._scrollStatusIntoView();
+ }
+ }
+
componentWillUnmount () {
detachFullscreenListener(this.onFullScreenChange);
}