diff --git a/app/soapbox/actions/statuses.ts b/app/soapbox/actions/statuses.ts index 5cf534446..9df7f207b 100644 --- a/app/soapbox/actions/statuses.ts +++ b/app/soapbox/actions/statuses.ts @@ -49,7 +49,7 @@ const statusExists = (getState: () => RootState, statusId: string) => { const createStatus = (params: Record, idempotencyKey: string, statusId: string | null) => { return (dispatch: AppDispatch, getState: () => RootState) => { - dispatch({ type: STATUS_CREATE_REQUEST, params, idempotencyKey }); + dispatch({ type: STATUS_CREATE_REQUEST, params, idempotencyKey, editing: !!statusId }); return api(getState).request({ url: statusId === null ? '/api/v1/statuses' : `/api/v1/statuses/${statusId}`, @@ -84,7 +84,7 @@ const createStatus = (params: Record, idempotencyKey: string, statu return status; }).catch(error => { - dispatch({ type: STATUS_CREATE_FAIL, error, params, idempotencyKey }); + dispatch({ type: STATUS_CREATE_FAIL, error, params, idempotencyKey, editing: !!statusId }); throw error; }); }; diff --git a/app/soapbox/reducers/statuses.ts b/app/soapbox/reducers/statuses.ts index 22b9e5ac0..49c946aa0 100644 --- a/app/soapbox/reducers/statuses.ts +++ b/app/soapbox/reducers/statuses.ts @@ -202,9 +202,9 @@ export default function statuses(state = initialState, action: AnyAction): State case STATUSES_IMPORT: return importStatuses(state, action.statuses, action.expandSpoilers); case STATUS_CREATE_REQUEST: - return incrementReplyCount(state, action.params); + return action.editing ? state : incrementReplyCount(state, action.params); case STATUS_CREATE_FAIL: - return decrementReplyCount(state, action.params); + return action.editing ? state : decrementReplyCount(state, action.params); case FAVOURITE_REQUEST: return simulateFavourite(state, action.status.id, true); case UNFAVOURITE_REQUEST: