Skip to content

A platform for community discussion. Free, open, simple.

DEV: Ensure current-post-changed is fired when switching between topics (#23930)

David Taylorb3df0a362ba7
diff --git a/app/assets/javascripts/discourse/app/components/scrolling-post-stream.js b/app/assets/javascripts/discourse/app/components/scrolling-post-stream.js
index 697190e439a..5d649a89a5f 100644
--- a/app/assets/javascripts/discourse/app/components/scrolling-post-stream.js
+++ b/app/assets/javascripts/discourse/app/components/scrolling-post-stream.js
@@ -37,7 +37,7 @@ export default MountWidget.extend({
widget: "post-stream",
_topVisible: null,
_bottomVisible: null,
- _currentPost: null,
+ _currentPostObj: null,
_currentVisible: null,
_currentPercent: null,
@@ -219,11 +219,11 @@ export default MountWidget.extend({
this.bottomVisibleChanged({ post: last, refresh });
}
- const changedPost = this._currentPost !== currentPost;
+ const currentPostObj = posts.objectAt(currentPost);
+ const changedPost = this._currentPostObj !== currentPostObj;
if (changedPost) {
- this._currentPost = currentPost;
- const post = posts.objectAt(currentPost);
- this.currentPostChanged({ post });
+ this._currentPostObj = currentPostObj;
+ this.currentPostChanged({ post: currentPostObj });
}
if (percent !== null) {
@@ -237,7 +237,7 @@ export default MountWidget.extend({
} else {
this._topVisible = null;
this._bottomVisible = null;
- this._currentPost = null;
+ this._currentPostObj = null;
this._currentPercent = null;
}