Skip to content

Commit

Permalink
show pending publishes immediately wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Yesmunt committed Nov 1, 2018
1 parent c3ef95d commit 1be48a1
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/renderer/redux/actions/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -281,6 +296,7 @@ export const doPublish = (params: PublishParams) => (
export const doCheckPendingPublishes = () => (dispatch: Dispatch<Action>, getState: GetState) => {
const state = getState();
const pendingById = selectPendingById(state);

if (!Object.keys(pendingById)) {
return;
}
Expand Down

0 comments on commit 1be48a1

Please sign in to comment.