add deep-equal to process update

This commit is contained in:
Jonathan Rainville 2018-09-06 09:45:40 -04:00 committed by Pascal Precht
parent 2ca33e221d
commit 0bdcb1f41b
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 5 additions and 2 deletions

View File

@ -9,13 +9,16 @@ import Processes from '../components/Processes';
import Versions from '../components/Versions'; import Versions from '../components/Versions';
import Console from '../components/Console'; import Console from '../components/Console';
import {getProcesses, getCommands, getVersions, getProcessLogs} from "../reducers/selectors"; import {getProcesses, getCommands, getVersions, getProcessLogs} from "../reducers/selectors";
import deepEqual from 'deep-equal';
class HomeContainer extends Component { class HomeContainer extends Component {
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
if (!prevProps.processes.length) { if (!deepEqual(this.props.processes, prevProps.processes)) {
this.props.processes.forEach(process => { this.props.processes.forEach(process => {
this.props.fetchProcessLogs(process.name); this.props.fetchProcessLogs(process.name);
if (!prevProps.processes.length) {
this.props.listenToProcessLogs(process.name); this.props.listenToProcessLogs(process.name);
}
}); });
} }
} }