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