mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:57:10 -06:00
FIX: ensures topic info is dynamic with scroll (#27082)
Prior to this fix we were using `topic.current_post_number` which is coming from the server side and represents the initial topic scroll position when initially rendered to the end user. However, this value is not dynamic and is not updated when the user scrolls, `topic.currentPost` is the dynamic equivalent. No test as there are very low chances a test like this one based on scroll position, will be reliable over time.
This commit is contained in:
parent
29bf61d5dd
commit
9302187ca4
@ -1,14 +1,14 @@
|
||||
import { getOwner } from "@ember/application";
|
||||
|
||||
export function extractCurrentTopicInfo(context) {
|
||||
const topic = getOwner(context).lookup("controller:topic")?.get("model");
|
||||
const topic = getOwner(context).lookup("controller:topic")?.model;
|
||||
|
||||
if (!topic) {
|
||||
return;
|
||||
}
|
||||
|
||||
const info = { context_topic_id: topic.id };
|
||||
const currentPostNumber = parseInt(topic.current_post_number, 10);
|
||||
const currentPostNumber = topic.currentPost;
|
||||
const posts = topic.postStream.posts;
|
||||
|
||||
const currentPost = posts.find(
|
||||
|
Loading…
Reference in New Issue
Block a user