call getProcesses in componentDidMount
This commit is contained in:
parent
ae3185d96f
commit
86b2dcc2da
|
@ -12,17 +12,25 @@ import {getProcesses, getCommands, getVersions, getProcessLogs} from "../reducer
|
|||
import deepEqual from 'deep-equal';
|
||||
|
||||
class HomeContainer extends Component {
|
||||
componentDidMount() {
|
||||
this.getProcesses();
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
if (!deepEqual(this.props.processes, prevProps.processes)) {
|
||||
this.props.processes.forEach(process => {
|
||||
this.props.fetchProcessLogs(process.name);
|
||||
if (!prevProps.processes.length) {
|
||||
this.props.listenToProcessLogs(process.name);
|
||||
}
|
||||
});
|
||||
this.getProcesses(prevProps);
|
||||
}
|
||||
}
|
||||
|
||||
getProcesses(prevProps) {
|
||||
this.props.processes.forEach(process => {
|
||||
this.props.fetchProcessLogs(process.name);
|
||||
if (!prevProps || !prevProps.processes.length) {
|
||||
this.props.listenToProcessLogs(process.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<React.Fragment>
|
||||
|
|
Loading…
Reference in New Issue