fix duplicate keys on search results

This commit is contained in:
Jeremy Kauffman 2017-01-12 23:12:53 -05:00 committed by Alex Liebowitz
parent 4fd9828760
commit 6c67cee3d9

View file

@ -41,11 +41,15 @@ var SearchNoResults = React.createClass({
var SearchResults = React.createClass({
render: function() {
var rows = [];
var rows = [],
seenNames = {}; //fix this when the search API returns claim IDs
this.props.results.forEach(function({name, value}) {
rows.push(
<FileTile key={name} name={name} />
);
if (!seenNames[name]) {
seenNames[name] = name;
rows.push(
<FileTile key={name} name={name} />
);
}
});
return (
<div>{rows}</div>