diff --git a/framework/core/js/src/forum/components/PostStream.js b/framework/core/js/src/forum/components/PostStream.js index 37ee017ae..a80f75bec 100644 --- a/framework/core/js/src/forum/components/PostStream.js +++ b/framework/core/js/src/forum/components/PostStream.js @@ -121,15 +121,10 @@ export default class PostStream extends Component { * Start scrolling, if appropriate, to a newly-targeted post. */ triggerScroll() { - if (!this.attrs.targetPost) return; + if (!this.attrs.targetPost || !this.stream.needsScroll) return; - const oldTarget = this.prevTarget; const newTarget = this.attrs.targetPost; - - if (oldTarget) { - if ('number' in oldTarget && oldTarget.number === newTarget.number) return; - if ('index' in oldTarget && oldTarget.index === newTarget.index) return; - } + this.stream.needsScroll = false; if ('number' in newTarget) { this.scrollToNumber(newTarget.number, this.stream.animateScroll); @@ -137,8 +132,6 @@ export default class PostStream extends Component { const backwards = newTarget.index === this.stream.count() - 1; this.scrollToIndex(newTarget.index, this.stream.animateScroll, backwards); } - - this.prevTarget = newTarget; } /** diff --git a/framework/core/js/src/forum/states/PostStreamState.js b/framework/core/js/src/forum/states/PostStreamState.js index 2c827bff3..8f93e8f1f 100644 --- a/framework/core/js/src/forum/states/PostStreamState.js +++ b/framework/core/js/src/forum/states/PostStreamState.js @@ -103,6 +103,7 @@ class PostStreamState { this.loadPromise = this.loadNearNumber(number); + this.needsScroll = true; this.targetPost = { number }; this.animateScroll = !noAnimation; this.number = number; @@ -127,6 +128,7 @@ class PostStreamState { this.loadPromise = this.loadNearIndex(index); + this.needsScroll = true; this.targetPost = { index }; this.animateScroll = !noAnimation; this.index = index;