Skip to content

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

FIX: Wait for async `Topic.apply_transformations` during `loadMore` (#26143)

David Taylora24c16c911b5
diff --git a/app/assets/javascripts/discourse/app/models/topic-list.js b/app/assets/javascripts/discourse/app/models/topic-list.js
index f649b38223f..bffccb495f9 100644
--- a/app/assets/javascripts/discourse/app/models/topic-list.js
+++ b/app/assets/javascripts/discourse/app/models/topic-list.js
@@ -185,13 +185,13 @@ export default class TopicList extends RestModel {
this.set("loadingMore", true);
- return ajax({ url: moreUrl }).then((result) => {
+ return ajax({ url: moreUrl }).then(async (result) => {
let topicsAdded = 0;
if (result) {
// the new topics loaded from the server
const newTopics = TopicList.topicsFrom(this.store, result);
- Topic.applyTransformations(newTopics);
+ await Topic.applyTransformations(newTopics);
this.forEachNew(newTopics, (t) => {
t.set("highlight", topicsAdded++ === 0);