From 171db54df004e3348a92498c86e5a3c3c1b3cd39 Mon Sep 17 00:00:00 2001 From: GreenAsJade Date: Sat, 21 Dec 2024 14:47:24 +1030 Subject: [PATCH] Fix attaching actions to reports in report list view --- .../IncidentReportTracker/IncidentReportList.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/components/IncidentReportTracker/IncidentReportList.tsx b/src/components/IncidentReportTracker/IncidentReportList.tsx index 6e94c6e034..455d819fae 100644 --- a/src/components/IncidentReportTracker/IncidentReportList.tsx +++ b/src/components/IncidentReportTracker/IncidentReportList.tsx @@ -39,8 +39,8 @@ export function IncidentReportList({ data.set("ui-state.show_incident_list", false); } - const attachActions = (report: Report) => { - // Most of these may no longer be needed, since we're using the new ReportsCenter view. + // Attach appropriate actions to each report + reports.forEach((report) => { if (report.state !== "resolved") { report.unclaim = () => { post(`moderation/incident/${report.id}`, { id: report.id, action: "unclaim" }) @@ -112,11 +112,7 @@ export function IncidentReportList({ }); }; } - }; - - React.useEffect(() => { - reports.forEach(attachActions); - }, [reports]); + }); return (