From 89e25c9b81e60d0d0a8e40c73700ab5de464cc30 Mon Sep 17 00:00:00 2001 From: badrAZ Date: Fri, 16 Mar 2018 16:37:57 +0100 Subject: [PATCH] fix(xo-web/dashboard/overview): missing patches not fetched (#2772) Fixes #2768 --- .../xo-web/src/common/hosts-patches-table.js | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/packages/xo-web/src/common/hosts-patches-table.js b/packages/xo-web/src/common/hosts-patches-table.js index 5bf75b231..07874aa72 100644 --- a/packages/xo-web/src/common/hosts-patches-table.js +++ b/packages/xo-web/src/common/hosts-patches-table.js @@ -1,6 +1,6 @@ import React from 'react' import { Portal } from 'react-overlays' -import { forEach, isEmpty, keys, map, noop } from 'lodash' +import { forEach, isEmpty, keys, map } from 'lodash' import _ from './intl' import ActionButton from './action-button' @@ -76,9 +76,6 @@ const ActionButton_ = ({ children, labelId, ...props }) => ( // =================================================================== -@connectStore({ - hostsById: createGetObjectsOfType('host').groupBy('id'), -}) class HostsPatchesTable extends Component { constructor (props) { super(props) @@ -94,21 +91,15 @@ class HostsPatchesTable extends Component { ) _subscribeMissingPatches = (hosts = this.props.hosts) => { - const { hostsById } = this.props - - const unsubs = map( - hosts, - host => - hostsById - ? subscribeHostMissingPatches(hostsById[host.id][0], patches => - this.setState({ - missingPatches: { - ...this.state.missingPatches, - [host.id]: patches.length, - }, - }) - ) - : noop + const unsubs = map(hosts, host => + subscribeHostMissingPatches(host, patches => + this.setState({ + missingPatches: { + ...this.state.missingPatches, + [host.id]: patches.length, + }, + }) + ) ) if (this.unsubscribeMissingPatches !== undefined) {