mirror of
https://github.com/mastodon/mastodon
synced 2024-12-14 22:59:07 +09:00
Fix clicking on already-loaded thread scrolling to the top of the thread (#27338)
This commit is contained in:
parent
6dcccd325f
commit
bcfc3b3f65
@ -220,6 +220,8 @@ class Status extends ImmutablePureComponent {
|
|||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
attachFullscreenListener(this.onFullScreenChange);
|
attachFullscreenListener(this.onFullScreenChange);
|
||||||
|
|
||||||
|
this._scrollStatusIntoView();
|
||||||
}
|
}
|
||||||
|
|
||||||
UNSAFE_componentWillReceiveProps (nextProps) {
|
UNSAFE_componentWillReceiveProps (nextProps) {
|
||||||
@ -579,10 +581,10 @@ class Status extends ImmutablePureComponent {
|
|||||||
this.node = c;
|
this.node = c;
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidUpdate (prevProps) {
|
_scrollStatusIntoView () {
|
||||||
const { status, ancestorsIds, multiColumn } = this.props;
|
const { status, multiColumn } = this.props;
|
||||||
|
|
||||||
if (status && (ancestorsIds.size > prevProps.ancestorsIds.size || prevProps.status?.get('id') !== status.get('id'))) {
|
if (status) {
|
||||||
window.requestAnimationFrame(() => {
|
window.requestAnimationFrame(() => {
|
||||||
this.node?.querySelector('.detailed-status__wrapper')?.scrollIntoView(true);
|
this.node?.querySelector('.detailed-status__wrapper')?.scrollIntoView(true);
|
||||||
|
|
||||||
@ -599,6 +601,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 () {
|
componentWillUnmount () {
|
||||||
detachFullscreenListener(this.onFullScreenChange);
|
detachFullscreenListener(this.onFullScreenChange);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user