We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cb6a987 commit 7e64913Copy full SHA for 7e64913
src/addon/mod/forum/providers/prefetch-handler.ts
@@ -122,7 +122,24 @@ export class AddonModForumPrefetchHandler extends CoreCourseActivityPrefetchHand
122
});
123
124
125
- return Promise.all(promises);
+ return Promise.all(promises).then((results) => {
126
+ // Each order has returned its own list of posts. Merge all the lists, preventing duplicates.
127
+ const posts = [],
128
+ postIds = {}; // To make the array unique.
129
+
130
+ results.forEach((orderResults) => {
131
+ orderResults.forEach((orderResult) => {
132
+ orderResult.posts.forEach((post) => {
133
+ if (!postIds[post.id]) {
134
+ postIds[post.id] = true;
135
+ posts.push(post);
136
+ }
137
+ });
138
139
140
141
+ return posts;
142
143
}
144
145
/**
0 commit comments