From c62409a8f68174a8ab173277aac66b4824ae994a Mon Sep 17 00:00:00 2001 From: Jordan Ramos Date: Fri, 5 Jun 2026 10:52:01 -0600 Subject: [PATCH] Fix Action Coverage donut not updating when notes change NoteCell now propagates saved notes back to the findings state via onNoteSaved callback. This allows classifyFinding() to immediately reclassify items from 'pending' to 'archer' when an EXC- note is added, updating the Action Coverage donut without a page refresh. --- .../src/components/pages/ReportingPage.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/pages/ReportingPage.js b/frontend/src/components/pages/ReportingPage.js index 1a5e0ec..8200fd3 100644 --- a/frontend/src/components/pages/ReportingPage.js +++ b/frontend/src/components/pages/ReportingPage.js @@ -860,7 +860,7 @@ function OverrideCell({ findingId, field, originalValue, initialOverride, canWri // --------------------------------------------------------------------------- // NoteCell — inline editable, saves on blur // --------------------------------------------------------------------------- -function NoteCell({ findingId, initialNote }) { +function NoteCell({ findingId, initialNote, onNoteSaved }) { const [value, setValue] = useState(initialNote || ''); const [saving, setSaving] = useState(false); const lastSaved = useRef(initialNote || ''); @@ -881,12 +881,13 @@ function NoteCell({ findingId, initialNote }) { body: JSON.stringify({ note: value }) }); lastSaved.current = value; + if (onNoteSaved) onNoteSaved(findingId, value); } catch (e) { console.error('Failed to save note:', e); } finally { setSaving(false); } - }, [findingId, value]); + }, [findingId, value, onNoteSaved]); return (
@@ -1188,7 +1189,7 @@ function FilterDropdown({ anchorEl, colKey, findings, activeFilter, onFilterChan // --------------------------------------------------------------------------- // Render a single table cell by column key // --------------------------------------------------------------------------- -function TableCell({ colKey, finding, canWrite, onCveMouseEnter, onCveMouseLeave, onIpMouseEnter, onIpMouseLeave, fpSubmissions, onEditSubmission, atlasStatusMap, onAtlasBadgeClick }) { +function TableCell({ colKey, finding, canWrite, onCveMouseEnter, onCveMouseLeave, onIpMouseEnter, onIpMouseLeave, fpSubmissions, onEditSubmission, atlasStatusMap, onAtlasBadgeClick, onNoteSaved }) { switch (colKey) { case 'findingId': return ( @@ -1351,7 +1352,7 @@ function TableCell({ colKey, finding, canWrite, onCveMouseEnter, onCveMouseLeave case 'note': return ( - + ); default: @@ -6413,6 +6414,10 @@ export default function VulnerabilityTriagePage({ filterDate, filterEXC }) { setEditSubmission(submission); }, []); + const handleNoteSaved = useCallback((findingId, note) => { + setFindings(prev => prev.map(f => f.id === findingId ? { ...f, note } : f)); + }, []); + const handleEditSuccess = useCallback(() => { fetchFpSubmissions(); fetchQueue(); @@ -7331,7 +7336,7 @@ export default function VulnerabilityTriagePage({ filterDate, filterEXC }) { {visibleCols.map((col) => ( - { setAtlasSelectedHostId(hostId); setAtlasSelectedHostName(finding.hostName || finding.ipAddress || ''); setAtlasSelectedFindingId(finding.id || null); setAtlasPanelOpen(true); }} /> + { setAtlasSelectedHostId(hostId); setAtlasSelectedHostName(finding.hostName || finding.ipAddress || ''); setAtlasSelectedFindingId(finding.id || null); setAtlasPanelOpen(true); }} onNoteSaved={handleNoteSaved} /> ))} ); @@ -7439,7 +7444,7 @@ export default function VulnerabilityTriagePage({ filterDate, filterEXC }) { {visibleCols.map((col) => ( - { setAtlasSelectedHostId(hostId); setAtlasSelectedHostName(finding.hostName || finding.ipAddress || ''); setAtlasSelectedFindingId(finding.id || null); setAtlasPanelOpen(true); }} /> + { setAtlasSelectedHostId(hostId); setAtlasSelectedHostName(finding.hostName || finding.ipAddress || ''); setAtlasSelectedFindingId(finding.id || null); setAtlasPanelOpen(true); }} onNoteSaved={handleNoteSaved} /> ))} ); @@ -7540,7 +7545,7 @@ export default function VulnerabilityTriagePage({ filterDate, filterEXC }) { /> {visibleCols.map((col) => ( - { setAtlasSelectedHostId(hostId); setAtlasSelectedHostName(finding.hostName || finding.ipAddress || ''); setAtlasSelectedFindingId(finding.id || null); setAtlasPanelOpen(true); }} /> + { setAtlasSelectedHostId(hostId); setAtlasSelectedHostName(finding.hostName || finding.ipAddress || ''); setAtlasSelectedFindingId(finding.id || null); setAtlasPanelOpen(true); }} onNoteSaved={handleNoteSaved} /> ))} );