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 newly published files appearing twice
* Fixed unconfirmed published files missing channel name
* Fixed old files from updated published claims appearing in downloaded list
### Deprecated
*

View file

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

View file

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

View file

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

View file

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