From ecfcc95bebbdbe303b3ea065134457a5e168fb89 Mon Sep 17 00:00:00 2001 From: infiinte-persistence Date: Tue, 18 May 2021 01:23:37 +0800 Subject: [PATCH] Clear 'thumbnailError' when uploading new one ## Issue "thumbnail is invalid" not reset with new thumbnail upload #6044 https://github.com/lbryio/lbry-desktop/issues/6044 ## Change The previous PR only covered the scenario of changing between NEW and EDIT. This one covers "uploading new". --- dist/bundle.es.js | 10 +++++++++- src/redux/actions/publish.js | 22 +++++++++++++++------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index e292bea..867e17b 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -4634,7 +4634,8 @@ const doResetThumbnailStatus = () => dispatch => { dispatch({ type: UPDATE_PUBLISH_FORM, data: { - thumbnailPath: '' + thumbnailPath: '', + thumbnailError: undefined } }); @@ -4691,6 +4692,13 @@ const doUploadThumbnail = (filePath, thumbnailBlob, fsAdapter, fs, path) => disp }, doError(error))); }; + dispatch({ + type: UPDATE_PUBLISH_FORM, + data: { + thumbnailError: undefined + } + }); + const doUpload = data => { return fetch(SPEECH_PUBLISH, { method: 'POST', diff --git a/src/redux/actions/publish.js b/src/redux/actions/publish.js index 181a378..36222c0 100644 --- a/src/redux/actions/publish.js +++ b/src/redux/actions/publish.js @@ -21,6 +21,7 @@ export const doResetThumbnailStatus = () => (dispatch: Dispatch) => { type: ACTIONS.UPDATE_PUBLISH_FORM, data: { thumbnailPath: '', + thumbnailError: undefined, }, }); @@ -96,6 +97,13 @@ export const doUploadThumbnail = ( ); }; + dispatch({ + type: ACTIONS.UPDATE_PUBLISH_FORM, + data: { + thumbnailError: undefined, + }, + }); + const doUpload = data => { return fetch(SPEECH_PUBLISH, { method: 'POST', @@ -106,12 +114,12 @@ export const doUploadThumbnail = ( .then(json => { return json.success ? dispatch({ - type: ACTIONS.UPDATE_PUBLISH_FORM, - data: { - uploadThumbnailStatus: THUMBNAIL_STATUSES.COMPLETE, - thumbnail: json.data.serveUrl, - }, - }) + type: ACTIONS.UPDATE_PUBLISH_FORM, + data: { + uploadThumbnailStatus: THUMBNAIL_STATUSES.COMPLETE, + thumbnail: json.data.serveUrl, + }, + }) : uploadError(json.message || downMessage); }) .catch(err => { @@ -413,7 +421,7 @@ export const doCheckReflectingFiles = () => (dispatch: Dispatch, getState: GetSt const { checkingReflector } = state.claims; let reflectorCheckInterval; - const checkFileList = async() => { + const checkFileList = async () => { const state = getState(); const reflectingById = selectReflectingById(state); const ids = Object.keys(reflectingById);