From 6d687e188cbb414ece2e5b197f56f907dae3ac6c Mon Sep 17 00:00:00 2001 From: Christopher Gurnee Date: Thu, 21 Apr 2022 22:14:52 +0000 Subject: [PATCH] Fix default of scrolling past the post w/permalinks Regression from 536bccb --- src/pages/thread/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/thread/index.js b/src/pages/thread/index.js index 94c08b8..12d5862 100644 --- a/src/pages/thread/index.js +++ b/src/pages/thread/index.js @@ -318,8 +318,7 @@ class Thread extends React.Component { this.setCurContig(insertBefore - 1) // (this was the failed earlier attempt) console.timeEnd('Load comments') this.props.global.setSuccess() - loadingComments = false - this.setState({pushshiftCommentLookup, loadingComments, reloadingComments: false}) + this.setState({pushshiftCommentLookup, loadingComments: false, reloadingComments: false}) } } else createdUtcNotFound = true @@ -341,7 +340,8 @@ class Thread extends React.Component { } const { location } = this.props - if (location.state?.scrollBehavior && location.hash.length > 1 && !this.props.global.isErrored()) { + if (location.state?.scrollBehavior && location.hash.length > 1 && + !loadingComments && !this.props.global.isErrored()) { const hashElem = document.getElementById(location.hash.substring(1)) if (hashElem) { hashElem.scrollIntoView({behavior: location.state.scrollBehavior})