fix react missing key in list entries warning

This commit is contained in:
Sebastian Sdorra
2018-10-17 15:03:32 +02:00
parent f95b28e15d
commit 1a07827fb6
2 changed files with 8 additions and 4 deletions

View File

@@ -12,10 +12,10 @@ type Props = {
class ChangesetList extends React.Component<Props> {
render() {
const { repository, changesets } = this.props;
const content = changesets.map((changeset, index) => {
const content = changesets.map(changeset => {
return (
<ChangesetRow
key={index}
key={changeset.id}
repository={repository}
changeset={changeset}
/>

View File

@@ -9,6 +9,7 @@ import injectSheet from "react-jss";
import { DateFromNow } from "@scm-manager/ui-components";
import ChangesetAuthor from "./ChangesetAuthor";
import ChangesetTag from "./ChangesetTag";
import { compose } from "redux";
const styles = {
pointer: {
@@ -74,7 +75,7 @@ class ChangesetRow extends React.Component<Props> {
return (
<div className="media-right">
{tags.map((tag: Tag) => {
return <ChangesetTag tag={tag} />;
return <ChangesetTag key={tag.name} tag={tag} />;
})}
</div>
);
@@ -83,4 +84,7 @@ class ChangesetRow extends React.Component<Props> {
};
}
export default injectSheet(styles)(translate("repos")(ChangesetRow));
export default compose(
injectSheet(styles),
translate("repos")
)(ChangesetRow);