From 1be48a18badb44dc5c9d62aa7f3871161fcea4f1 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 31 Oct 2018 23:45:26 -0400 Subject: [PATCH] show pending publishes immediately wip --- src/renderer/redux/actions/publish.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/renderer/redux/actions/publish.js b/src/renderer/redux/actions/publish.js index af0e9709a3b..3270e35d7aa 100644 --- a/src/renderer/redux/actions/publish.js +++ b/src/renderer/redux/actions/publish.js @@ -262,11 +262,26 @@ export const doPublish = (params: PublishParams) => ( dispatch({ type: ACTIONS.PUBLISH_START }); - const success = () => { - dispatch({ + const success = (pendingClaim) => { + const actions = []; + + actions.push({ type: ACTIONS.PUBLISH_SUCCESS, }); - dispatch(doNotify({ id: MODALS.PUBLISH }, { uri })); + + actions.push(doNotify({ id: MODALS.PUBLISH }, { uri })) + + // We have to fake a temp claim until the new pending one is returned by claim_list_mine + // We can't rely on claim_list_mine because there might be some delay before the new claims are returned + // Doing this allows us to show the pending claim immediately, it will get overwritten by the real one + actions.push({ + type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED, + data: { + claims: [{ ...pendingClaim.output }] + } + }); + + dispatch(batchActions(...actions)); }; const failure = error => { @@ -281,6 +296,7 @@ export const doPublish = (params: PublishParams) => ( export const doCheckPendingPublishes = () => (dispatch: Dispatch, getState: GetState) => { const state = getState(); const pendingById = selectPendingById(state); + if (!Object.keys(pendingById)) { return; }