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