mirror of https://github.com/docker/docs.git
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:
parent
b67c1a912e
commit
dfe80af6e4
|
@ -9,8 +9,14 @@ var ContainerList = React.createClass({
|
||||||
render: function () {
|
render: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
var containers = this.props.containers.map(function (container) {
|
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 (
|
return (
|
||||||
<ContainerListItem key={container.Id} container={container} start={self._start}/>
|
<ContainerListItem key={container_id} container={container} start={self._start} />
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
var newItem;
|
var newItem;
|
||||||
|
|
Loading…
Reference in New Issue