Stop old file infos from updated claims appearing in downloaded file list

This commit is contained in:
6ea86b96 2017-07-12 15:08:59 +07:00
parent 0419399dec
commit d1eb8f5de3
5 changed files with 20 additions and 11 deletions

View file

@ -21,6 +21,7 @@ Web UI version numbers should always match the corresponding version of LBRY App
* Fixed bug with download notice when switching window focus * Fixed bug with download notice when switching window focus
* Fixed newly published files appearing twice * Fixed newly published files appearing twice
* Fixed unconfirmed published files missing channel name * Fixed unconfirmed published files missing channel name
* Fixed old files from updated published claims appearing in downloaded list
### Deprecated ### Deprecated
* *

View file

@ -81,7 +81,7 @@ class FileList extends React.PureComponent {
content.push( content.push(
<FileTile <FileTile
key={uri} key={fileInfo.outpoint || fileInfo.claim_id}
uri={uri} uri={uri}
hidePrice={true} hidePrice={true}
showEmpty={this.props.fileTileShowEmpty} showEmpty={this.props.fileTileShowEmpty}

View file

@ -5,6 +5,11 @@ import {
selectFileInfosDownloaded, selectFileInfosDownloaded,
selectIsFetchingFileListDownloadedOrPublished, selectIsFetchingFileListDownloadedOrPublished,
} from "selectors/file_info"; } from "selectors/file_info";
import {
selectMyClaimsWithoutChannels,
selectIsFetchingClaimListMine,
} from "selectors/claims";
import { doFetchClaimListMine } from "actions/content";
import { doNavigate } from "actions/app"; import { doNavigate } from "actions/app";
import { doCancelAllResolvingUris } from "actions/content"; import { doCancelAllResolvingUris } from "actions/content";
import FileListDownloaded from "./view"; import FileListDownloaded from "./view";
@ -12,6 +17,8 @@ import FileListDownloaded from "./view";
const select = state => ({ const select = state => ({
fileInfos: selectFileInfosDownloaded(state), fileInfos: selectFileInfosDownloaded(state),
isFetching: selectIsFetchingFileListDownloadedOrPublished(state), isFetching: selectIsFetchingFileListDownloadedOrPublished(state),
claims: selectMyClaimsWithoutChannels(state),
isFetchingClaims: selectIsFetchingClaimListMine(state),
}); });
const perform = dispatch => ({ const perform = dispatch => ({
@ -19,6 +26,7 @@ const perform = dispatch => ({
fetchFileInfosDownloaded: () => fetchFileInfosDownloaded: () =>
dispatch(doFetchFileInfosAndPublishedClaims()), dispatch(doFetchFileInfosAndPublishedClaims()),
cancelResolvingUris: () => dispatch(doCancelAllResolvingUris()), cancelResolvingUris: () => dispatch(doCancelAllResolvingUris()),
fetchClaims: () => dispatch(doFetchClaimListMine()),
}); });
export default connect(select, perform)(FileListDownloaded); export default connect(select, perform)(FileListDownloaded);

View file

@ -12,6 +12,7 @@ import SubHeader from "component/subHeader";
class FileListDownloaded extends React.PureComponent { class FileListDownloaded extends React.PureComponent {
componentWillMount() { componentWillMount() {
if (!this.props.isFetchingClaims) this.props.fetchClaims();
if (!this.props.isFetching) this.props.fetchFileInfosDownloaded(); if (!this.props.isFetching) this.props.fetchFileInfosDownloaded();
} }

View file

@ -3,6 +3,7 @@ import { createSelector } from "reselect";
import { import {
selectClaimsByUri, selectClaimsByUri,
selectIsFetchingClaimListMine, selectIsFetchingClaimListMine,
selectMyClaims,
selectMyClaimsOutpoints, selectMyClaimsOutpoints,
} from "selectors/claims"; } from "selectors/claims";
@ -76,19 +77,17 @@ export const selectFileInfosPendingPublish = createSelector(
export const selectFileInfosDownloaded = createSelector( export const selectFileInfosDownloaded = createSelector(
selectFileInfosByOutpoint, selectFileInfosByOutpoint,
selectMyClaimsOutpoints, selectMyClaims,
(byOutpoint, myClaimOutpoints) => { (byOutpoint, myClaims) => {
const fileInfoList = []; return Object.values(byOutpoint).filter(fileInfo => {
Object.values(byOutpoint).forEach(fileInfo => { const myClaimIds = myClaims.map(claim => claim.claim_id);
if (
return (
fileInfo && fileInfo &&
myClaimOutpoints.indexOf(fileInfo.outpoint) === -1 && myClaimIds.indexOf(fileInfo.claim_id) === -1 &&
(fileInfo.completed || fileInfo.written_bytes) (fileInfo.completed || fileInfo.written_bytes)
) { );
fileInfoList.push(fileInfo);
}
}); });
return fileInfoList;
} }
); );