Skip to content

Commit

Permalink
Reload fixed on org change (#1270)
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuldsce authored Mar 31, 2022
1 parent e94e4a0 commit 681ded7
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions src/pages/main/dashboard/Dashboard.js
Original file line number Diff line number Diff line change
@@ -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 (
<div className='dashboard'>
<div className='dashboard' key={renderKey}>
<Control>
<Logs type={EVENT}/>
<Logs type={EVENT} />
</Control>
</div>
)
}
}

componentDidUpdate(preProps, preState) {
const { organizationInfo } = this.props
if (preProps.organizationInfo[localFields.organizationName] !== organizationInfo[localFields.organizationName]) {
this.setState({ renderKey: uniqueId() })
}
}
}

export default withRouter(Dashboard)
const mapStateToProps = (state) => {
return {
organizationInfo: state.organizationInfo.data
}
};

export default connect(mapStateToProps, null)(Dashboard);

0 comments on commit 681ded7

Please sign in to comment.