FIX: Wait for async `Topic.apply_transformations` during `loadMore` (#26143)
`apply_transformations` is an async function, and plugins/themes using it expect their transformations to be applied before the loadMore logic continues. This should resolve issues with unencrypted topics when scrolling down topic lists in discourse-encrypt.
This commit is contained in:
parent
0d64c886da
commit
a24c16c911
|
@ -185,13 +185,13 @@ export default class TopicList extends RestModel {
|
||||||
|
|
||||||
this.set("loadingMore", true);
|
this.set("loadingMore", true);
|
||||||
|
|
||||||
return ajax({ url: moreUrl }).then((result) => {
|
return ajax({ url: moreUrl }).then(async (result) => {
|
||||||
let topicsAdded = 0;
|
let topicsAdded = 0;
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
// the new topics loaded from the server
|
// the new topics loaded from the server
|
||||||
const newTopics = TopicList.topicsFrom(this.store, result);
|
const newTopics = TopicList.topicsFrom(this.store, result);
|
||||||
Topic.applyTransformations(newTopics);
|
await Topic.applyTransformations(newTopics);
|
||||||
|
|
||||||
this.forEachNew(newTopics, (t) => {
|
this.forEachNew(newTopics, (t) => {
|
||||||
t.set("highlight", topicsAdded++ === 0);
|
t.set("highlight", topicsAdded++ === 0);
|
||||||
|
|
Loading…
Reference in New Issue