Merge pull request #243 from lbryio/desktop-fixes

fix: download list in correct order
This commit is contained in:
Sean Yesmunt 2019-11-14 13:01:30 -05:00 committed by GitHub
commit fcc9746ff7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 12 deletions

4
dist/bundle.es.js vendored
View file

@ -2970,7 +2970,7 @@ const makeSelectLoadingForUri = uri => reselect.createSelector(selectUrisLoading
return isFetching;
});
const selectFileInfosDownloaded = reselect.createSelector(selectFileInfosByOutpoint, selectMyClaims, (byOutpoint, myClaims) => Object.values(byOutpoint).filter(fileInfo => {
const selectFileInfosDownloaded = reselect.createSelector(selectFileInfosByOutpoint, selectMyClaims, (byOutpoint, myClaims) => Object.values(byOutpoint).reverse().filter(fileInfo => {
const myClaimIds = myClaims.map(claim => claim.claim_id);
return fileInfo && myClaimIds.indexOf(fileInfo.claim_id) === -1 && (fileInfo.completed || fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0);
@ -3246,7 +3246,7 @@ function doFileList(page = 1, pageSize = 99999) {
dispatch({
type: FILE_LIST_SUCCEEDED,
data: {
fileInfos: fileInfos.reverse()
fileInfos: fileInfos
}
});
});

View file

@ -35,7 +35,7 @@ export function doFetchFileInfo(uri) {
};
}
export function doFileList(page: number = 1, pageSize: number = 99999) {
export function doFileList(page = 1, pageSize = 99999) {
return (dispatch, getState) => {
const state = getState();
const isFetching = selectIsFetchingFileList(state);
@ -50,7 +50,7 @@ export function doFileList(page: number = 1, pageSize: number = 99999) {
dispatch({
type: ACTIONS.FILE_LIST_SUCCEEDED,
data: {
fileInfos: fileInfos.reverse(),
fileInfos: fileInfos,
},
});
});

View file

@ -80,15 +80,17 @@ export const selectFileInfosDownloaded = createSelector(
selectFileInfosByOutpoint,
selectMyClaims,
(byOutpoint, myClaims) =>
Object.values(byOutpoint).filter(fileInfo => {
const myClaimIds = myClaims.map(claim => claim.claim_id);
Object.values(byOutpoint)
.reverse()
.filter(fileInfo => {
const myClaimIds = myClaims.map(claim => claim.claim_id);
return (
fileInfo &&
myClaimIds.indexOf(fileInfo.claim_id) === -1 &&
(fileInfo.completed || fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0)
);
})
return (
fileInfo &&
myClaimIds.indexOf(fileInfo.claim_id) === -1 &&
(fileInfo.completed || fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0)
);
})
);
// export const selectFileInfoForUri = (state, props) => {