only print an item in my_files once
This commit is contained in:
parent
ad3773ead4
commit
78f1fde34b
1 changed files with 6 additions and 3 deletions
|
@ -151,16 +151,19 @@ var MyFilesPage = React.createClass({
|
||||||
var content = <span>You haven't downloaded anything from LBRY yet. Go <Link href="/" label="search for your first download" />!</span>;
|
var content = <span>You haven't downloaded anything from LBRY yet. Go <Link href="/" label="search for your first download" />!</span>;
|
||||||
} else {
|
} else {
|
||||||
var content = [],
|
var content = [],
|
||||||
keyIndex = 0;
|
seenUris = {};
|
||||||
|
|
||||||
for (let fileInfo of this.state.filesInfo) {
|
for (let fileInfo of this.state.filesInfo) {
|
||||||
let {completed, written_bytes, total_bytes, lbry_uri, file_name, download_path,
|
let {completed, written_bytes, total_bytes, lbry_uri, file_name, download_path,
|
||||||
stopped, metadata} = fileInfo;
|
stopped, metadata} = fileInfo;
|
||||||
|
|
||||||
if (!metadata)
|
if (!metadata || seenUris[lbry_uri])
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
seenUris[lbry_uri] = true;
|
||||||
|
|
||||||
let {title, thumbnail} = metadata;
|
let {title, thumbnail} = metadata;
|
||||||
|
|
||||||
if (!fileInfo.pending && typeof metadata == 'object') {
|
if (!fileInfo.pending && typeof metadata == 'object') {
|
||||||
|
@ -175,7 +178,7 @@ var MyFilesPage = React.createClass({
|
||||||
var ratioLoaded = written_bytes / total_bytes;
|
var ratioLoaded = written_bytes / total_bytes;
|
||||||
var showWatchButton = (lbry.getMediaType(file_name) == 'video' || lbry.getMediaType(file_name) == 'audio');
|
var showWatchButton = (lbry.getMediaType(file_name) == 'video' || lbry.getMediaType(file_name) == 'audio');
|
||||||
|
|
||||||
content.push(<MyFilesRow key={lbry_uri + (++keyIndex)} lbryUri={lbry_uri} title={title || ('lbry://' + lbry_uri)} completed={completed} stopped={stopped}
|
content.push(<MyFilesRow key={lbry_uri} lbryUri={lbry_uri} title={title || ('lbry://' + lbry_uri)} completed={completed} stopped={stopped}
|
||||||
ratioLoaded={ratioLoaded} imgUrl={thumbnail} path={download_path}
|
ratioLoaded={ratioLoaded} imgUrl={thumbnail} path={download_path}
|
||||||
showWatchButton={showWatchButton} pending={pending} />);
|
showWatchButton={showWatchButton} pending={pending} />);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue