mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-26 22:31:13 +00:00
parent
e13ab2ee46
commit
a1125ddbf0
1 changed files with 5 additions and 10 deletions
|
@ -195,16 +195,7 @@ export class Post extends Component<any, PostState> {
|
||||||
document.addEventListener("scroll", this.commentScrollDebounced);
|
document.addEventListener("scroll", this.commentScrollDebounced);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(_lastProps: any, lastState: PostState) {
|
componentDidUpdate(_lastProps: any) {
|
||||||
if (
|
|
||||||
this.state.commentId &&
|
|
||||||
!this.state.scrolled &&
|
|
||||||
lastState.postRes &&
|
|
||||||
lastState.postRes.comments.length > 0
|
|
||||||
) {
|
|
||||||
this.scrollCommentIntoView();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Necessary if you are on a post and you click another post (same route)
|
// Necessary if you are on a post and you click another post (same route)
|
||||||
if (_lastProps.location.pathname !== _lastProps.history.location.pathname) {
|
if (_lastProps.location.pathname !== _lastProps.history.location.pathname) {
|
||||||
// TODO Couldnt get a refresh working. This does for now.
|
// TODO Couldnt get a refresh working. This does for now.
|
||||||
|
@ -548,6 +539,10 @@ export class Post extends Component<any, PostState> {
|
||||||
if (this.checkScrollIntoCommentsParam) {
|
if (this.checkScrollIntoCommentsParam) {
|
||||||
this.scrollIntoCommentSection();
|
this.scrollIntoCommentSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.state.commentId && !this.state.scrolled) {
|
||||||
|
this.scrollCommentIntoView();
|
||||||
|
}
|
||||||
} else if (op == UserOperation.CreateComment) {
|
} else if (op == UserOperation.CreateComment) {
|
||||||
let data = wsJsonToRes<CommentResponse>(msg).data;
|
let data = wsJsonToRes<CommentResponse>(msg).data;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue