From dfe80af6e4c7ae1eea77b3403778dff55cf36b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Sun, 5 Apr 2015 17:01:18 +0000 Subject: [PATCH] Fall-back to image name as key when there is no id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a container is first started and the image is downloading there is no id set. With this patch we'll check if the container has a id and and is downloading, if so we'll substitute it with the image name and render such. This will fix the react key props warning in the developer console as well as maybe give us some sort of performance boost(?) Signed-off-by: Kristján Oddsson --- src/ContainerList.react.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ContainerList.react.js b/src/ContainerList.react.js index 1d6d25a034..9b1dcf9cb4 100644 --- a/src/ContainerList.react.js +++ b/src/ContainerList.react.js @@ -9,8 +9,14 @@ var ContainerList = React.createClass({ render: function () { var self = this; var containers = this.props.containers.map(function (container) { + var container_id = container.Id; + if (!container_id && container.State.Downloading) { + // Fall back to the container image name when there is no id. (when the + // image is downloading). + container_id = container.Image; + } return ( - + ); }); var newItem;