From 02432887d02fdc7c46d027bda38ad5ecb7152f63 Mon Sep 17 00:00:00 2001 From: Ezerous Date: Tue, 15 Sep 2020 22:18:03 +0300 Subject: [PATCH] Minor fixes --- src/blocks/blocksSaga.js | 1 + src/drizzle/drizzleStatusSaga.js | 5 +---- src/transactions/transactionStackReducer.js | 20 ++++++++++++-------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/blocks/blocksSaga.js b/src/blocks/blocksSaga.js index 091e7bc..1a1fd6b 100644 --- a/src/blocks/blocksSaga.js +++ b/src/blocks/blocksSaga.js @@ -1,6 +1,7 @@ import { END, eventChannel } from 'redux-saga' import { all, call, put, take, takeEvery, takeLatest } from 'redux-saga/effects' import * as BlocksActions from './blockActions' +import * as ContractActions from '../contracts/constants' /* * Listen for Blocks diff --git a/src/drizzle/drizzleStatusSaga.js b/src/drizzle/drizzleStatusSaga.js index 1a71857..940f582 100644 --- a/src/drizzle/drizzleStatusSaga.js +++ b/src/drizzle/drizzleStatusSaga.js @@ -54,17 +54,14 @@ export function * initializeDrizzle (action) { } yield put({ type: BlocksActions.BLOCKS_LISTENING, drizzle, web3 }) + yield put({ type: DrizzleActions.DRIZZLE_INITIALIZED, drizzle }) } } } catch (error) { yield put({ type: DrizzleActions.DRIZZLE_FAILED, error }) console.error('Error initializing Drizzle:') console.error(error) - - return } - - yield put({ type: DrizzleActions.DRIZZLE_INITIALIZED }) } function * drizzleStatusSaga () { diff --git a/src/transactions/transactionStackReducer.js b/src/transactions/transactionStackReducer.js index c9cf4ac..73bdbb6 100644 --- a/src/transactions/transactionStackReducer.js +++ b/src/transactions/transactionStackReducer.js @@ -4,22 +4,26 @@ const initialState = [] const transactionStackReducer = (state = initialState, action) => { if (action.type === TransactionsActions.PUSH_TO_TXSTACK) { - return [...state, action.stackTempKey] + return [...state, action.stackTempKey]; } if (action.type === TransactionsActions.POP_FROM_TXSTACK) { - state.pop() - - return [...state] + return [...state.slice(0, -1)]; } if (action.type === TransactionsActions.TX_BROADCASTED) { - state[action.stackId] = action.txHash - - return [...state] + return state.map((txHash, index) => { + if (index !== action.stackId) { + // This isn't the item we care about - keep it as-is + return txHash; + } + + // Otherwise, this is the one we want - return an updated value + return action.txHash; + }) } - return state + return state; } export default transactionStackReducer