-import { Component, linkEvent, createRef, RefObject } from "inferno";
import autosize from "autosize";
+import { Component, createRef, linkEvent, RefObject } from "inferno";
import {
AddAdminResponse,
AddModToCommunityResponse,
this.fetchCrossPosts();
if (this.state.commentId) {
this.scrollCommentIntoView();
- } else if (new URLSearchParams(this.props.location.search).get('scrollToComments')) {
+ }
+
+ if (this.checkScrollIntoCommentsParam) {
this.scrollIntoCommentSection();
}
}
this.scrollCommentIntoView();
}
- if (new URLSearchParams(this.props.location.search).get('scrollToComments') ) {
+ if (this.checkScrollIntoCommentsParam) {
this.scrollIntoCommentSection();
}
this.markScrolledAsRead(this.state.commentId);
}
+ get checkScrollIntoCommentsParam() {
+ return Boolean(
+ new URLSearchParams(this.props.location.search).get("scrollToComments")
+ );
+ }
+
scrollIntoCommentSection() {
this.state.commentSectionRef.current?.scrollIntoView();
}
this.setState(this.state);
setupTippy();
if (!this.state.commentId) restoreScrollPosition(this.context);
- if (new URLSearchParams(this.props.location.search).get('scrollToComments') ) {
+
+ if (this.checkScrollIntoCommentsParam) {
this.scrollIntoCommentSection();
}
} else if (op == UserOperation.CreateComment) {