diff --git a/src/pages/main/dashboard/Dashboard.js b/src/pages/main/dashboard/Dashboard.js index 526df549c9..0fe93b5cba 100644 --- a/src/pages/main/dashboard/Dashboard.js +++ b/src/pages/main/dashboard/Dashboard.js @@ -1,23 +1,43 @@ import React from 'react' +import { connect } from 'react-redux' import { withRouter } from 'react-router-dom' import { EVENT } from '../../../helper/constant/perpetual' +import { uniqueId } from '../../../helper/constant/shared' +import { localFields } from '../../../services/fields' import Logs from './auditLog/Logs' import Control from './control/Control' class Dashboard extends React.Component { constructor(props) { super(props) + this.state = { + renderKey: uniqueId() + } } - + render() { + const { renderKey } = this.state return ( -
+
- +
) - } + } + + componentDidUpdate(preProps, preState) { + const { organizationInfo } = this.props + if (preProps.organizationInfo[localFields.organizationName] !== organizationInfo[localFields.organizationName]) { + this.setState({ renderKey: uniqueId() }) + } + } } -export default withRouter(Dashboard) \ No newline at end of file +const mapStateToProps = (state) => { + return { + organizationInfo: state.organizationInfo.data + } +}; + +export default connect(mapStateToProps, null)(Dashboard); \ No newline at end of file