Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit fb6d722

Browse files
committed
FIX: infinite scroll not working
1 parent 10c229e commit fb6d722

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

assets/javascripts/discourse/components/admin-report-sentiment-analysis.gjs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import DoughnutChart from "discourse/plugins/discourse-ai/discourse/components/d
1818

1919
export default class AdminReportSentimentAnalysis extends Component {
2020
@tracked selectedChart = null;
21-
@tracked posts = null;
21+
@tracked posts = [];
2222
@tracked hasMorePosts = false;
2323
@tracked nextOffset = 0;
2424
@tracked showingSelectedChart = false;
@@ -71,20 +71,6 @@ export default class AdminReportSentimentAnalysis extends Component {
7171
}
7272
}
7373

74-
doughnutTitle(data) {
75-
const MAX_TITLE_LENGTH = 18;
76-
const title = data?.title || "";
77-
const score = data?.total_score ? ` (${data.total_score})` : "";
78-
79-
if (title.length + score.length > MAX_TITLE_LENGTH) {
80-
return (
81-
title.substring(0, MAX_TITLE_LENGTH - score.length) + "..." + score
82-
);
83-
}
84-
85-
return title + score;
86-
}
87-
8874
async postRequest() {
8975
return await ajax("/discourse-ai/sentiment/posts", {
9076
data: {
@@ -217,7 +203,10 @@ export default class AdminReportSentimentAnalysis extends Component {
217203

218204
this.hasMorePosts = response.has_more;
219205
this.nextOffset = response.next_offset;
220-
return response.posts.map((post) => Post.create(post));
206+
207+
const mappedPosts = response.posts.map((post) => Post.create(post));
208+
this.posts.pushObjects(mappedPosts);
209+
return mappedPosts;
221210
} catch (e) {
222211
popupAjaxError(e);
223212
}
@@ -228,6 +217,7 @@ export default class AdminReportSentimentAnalysis extends Component {
228217
this.showingSelectedChart = false;
229218
this.selectedChart = null;
230219
this.activeFilter = "all";
220+
this.posts = [];
231221
}
232222

233223
<template>

0 commit comments

Comments
 (0)