Publish: Handle reflecting-state not updated correctly.

Fixes 4385 (lbry-desktop) `Don't show upload progress if no file exists (shows 0% progress)`

An undefined result exception was causing the reflecting-state update code to be missed, so Desktop still thinks the item is still reflecting and continues to show the "Uploading(0%)" status.
This commit is contained in:
infiinte-persistence 2020-07-10 18:16:09 +08:00
parent e6d89b0690
commit 85077f6f00
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
2 changed files with 30 additions and 26 deletions

28
dist/bundle.es.js vendored
View file

@ -4758,19 +4758,21 @@ const doCheckReflectingFiles = () => (dispatch, getState) => {
Promise.all(promises).then(function (results) {
results.forEach(function (res) {
const fileListItem = res.items[0];
const fileClaimId = fileListItem.claim_id;
const {
is_fully_reflected: done,
uploading_to_reflector: uploading,
reflector_progress: progress
} = fileListItem;
if (uploading) {
newReflectingById[fileClaimId] = {
fileListItem: fileListItem,
progress,
stalled: !done && !uploading
};
if (res.items[0]) {
const fileListItem = res.items[0];
const fileClaimId = fileListItem.claim_id;
const {
is_fully_reflected: done,
uploading_to_reflector: uploading,
reflector_progress: progress
} = fileListItem;
if (uploading) {
newReflectingById[fileClaimId] = {
fileListItem: fileListItem,
progress,
stalled: !done && !uploading
};
}
}
});
}).then(function () {

View file

@ -395,19 +395,21 @@ export const doCheckReflectingFiles = () => (dispatch: Dispatch, getState: GetSt
Promise.all(promises)
.then(results => {
results.forEach(res => {
const fileListItem = res.items[0];
const fileClaimId = fileListItem.claim_id;
const {
is_fully_reflected: done,
uploading_to_reflector: uploading,
reflector_progress: progress,
} = fileListItem;
if (uploading) {
newReflectingById[fileClaimId] = {
fileListItem: fileListItem,
progress,
stalled: !done && !uploading,
};
if (res.items[0]) {
const fileListItem = res.items[0];
const fileClaimId = fileListItem.claim_id;
const {
is_fully_reflected: done,
uploading_to_reflector: uploading,
reflector_progress: progress,
} = fileListItem;
if (uploading) {
newReflectingById[fileClaimId] = {
fileListItem: fileListItem,
progress,
stalled: !done && !uploading,
};
}
}
});
})