diff --git a/assets/js/Components/App.js b/assets/js/Components/App.js index e6b8f64d..b73b593b 100644 --- a/assets/js/Components/App.js +++ b/assets/js/Components/App.js @@ -233,14 +233,20 @@ class App extends React.Component { } handleIssueSave(newIssue, newReport) { - let { report } = this.state - report = {...report, ...newReport} + const oldReport = this.state.report; + + const report = { ...oldReport, ...newReport }; if (report && Array.isArray(report.issues)) { - report.issues = report.issues.map(issue => (issue.id == newIssue.id) ? newIssue : issue) + // Combine backend issues with frontend issue state + report.issues = report.issues.map((issue) => { + if (issue.id === newIssue.id) return newIssue; + const oldIssue = oldReport.issues.find((oldReportIssue) => oldReportIssue.id === issue.id); + return oldIssue !== undefined ? { ...oldIssue, ...issue } : issue; + }); } - this.setState({ report }) + this.setState({ report }); } handleFileSave(newFile, newReport) { diff --git a/assets/js/Components/ContentPage.js b/assets/js/Components/ContentPage.js index 78390795..54124c10 100644 --- a/assets/js/Components/ContentPage.js +++ b/assets/js/Components/ContentPage.js @@ -91,9 +91,17 @@ class ContentPage extends React.Component { } handleCloseButton = () => { + const newReport = { ...this.props.report }; + newReport.issues = newReport.issues.map((issue) => { + issue.recentlyResolved = false; + issue.recentlyUpdated = false; + return issue; + }); + this.setState({ + report: newReport, modalOpen: false - }) + }); } handleTrayToggle = (e, val) => {