mirror of
https://github.com/docker/docs.git
synced 2026-11-06 12:54:24 +03:00
Fall-back to image name as key when there is no id
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 <koddsson@gmail.com>
This commit is contained in:
@@ -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 (
|
||||
<ContainerListItem key={container.Id} container={container} start={self._start}/>
|
||||
<ContainerListItem key={container_id} container={container} start={self._start} />
|
||||
);
|
||||
});
|
||||
var newItem;
|
||||
|
||||
Reference in New Issue
Block a user