Island: refactor RansomwareReport.js to not use the props in state initialization

This commit is contained in:
VakarisZ 2021-07-13 15:33:50 +03:00
parent b408c650dc
commit 3e2cf1d69c
1 changed files with 2 additions and 15 deletions

View File

@ -9,28 +9,15 @@ import '../../styles/pages/report/RansomwareReport.scss';
class RansomwareReport extends React.Component {
constructor(props) {
super(props);
this.state = {
report: props.report
};
}
componentDidUpdate(prevProps) {
if (this.props.report !== prevProps.report) {
this.setState({report: this.props.report})
}
}
stillLoadingDataFromServer() {
return Object.keys(this.state.report).length === 0;
return Object.keys(this.props.report).length === 0;
}
generateReportContent() {
return (
<div>
{this.getExploitationStats()}
<FileEncryptionTable tableData={this.state.report.encrypted_files_table} />
<FileEncryptionTable tableData={this.props.report.encrypted_files_table} />
</div>
)
}