summaryrefslogtreecommitdiff
path: root/src/components/map/groups/DatacenterGroup.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/map/groups/DatacenterGroup.js')
-rw-r--r--src/components/map/groups/DatacenterGroup.js20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/components/map/groups/DatacenterGroup.js b/src/components/map/groups/DatacenterGroup.js
index 3b7a086b..d7e349be 100644
--- a/src/components/map/groups/DatacenterGroup.js
+++ b/src/components/map/groups/DatacenterGroup.js
@@ -1,14 +1,20 @@
import React from "react";
import {Group} from "react-konva";
+import Shapes from "../../../shapes/index";
import RoomGroup from "./RoomGroup";
-const DatacenterGroup = ({datacenter}) => (
- <Group>
- {datacenter.rooms.map(room => (
- <RoomGroup room={room}/>
- ))}
- </Group>
-);
+const DatacenterGroup = ({datacenter}) => {
+ if (!datacenter) {
+ return <Group/>;
+ }
+ return (
+ <Group>
+ {datacenter.rooms.map(room => (
+ <RoomGroup key={room.id} room={room}/>
+ ))}
+ </Group>
+ );
+};
DatacenterGroup.propTypes = {
datacenter: Shapes.Datacenter,