From bb91bb1ee2705d5f26fdc0e094031284797169a1 Mon Sep 17 00:00:00 2001 From: Nicola Brunner Date: Thu, 7 May 2020 09:51:38 +0200 Subject: [PATCH] fixed warning message in device panel thanks to andrea --- smart-hut/src/components/dashboard/DevicePanel.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/smart-hut/src/components/dashboard/DevicePanel.js b/smart-hut/src/components/dashboard/DevicePanel.js index 23db867..f55ee11 100644 --- a/smart-hut/src/components/dashboard/DevicePanel.js +++ b/smart-hut/src/components/dashboard/DevicePanel.js @@ -25,7 +25,7 @@ class DevicePanel extends Component { render() { return ( - {this.props.devices.length !== 0 ? ( + {this.props.numbeOfRooms > 0 ? ( {this.props.devices.map((e, i) => { return ; @@ -70,6 +70,9 @@ const mapStateToProps = (state, _) => ({ return state.active.activeRoom === -1; }, activeRoom: state.active.activeRoom, + get numbeOfRooms() { + return Object.keys(state.rooms).length; + }, }); const DevicePanelContainer = connect( mapStateToProps,