Skip to content
This repository has been archived by the owner on Sep 27, 2019. It is now read-only.

Commit

Permalink
Added code that prevents double addition of contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
asselstine committed May 17, 2018
1 parent cd92f7a commit 6ccdbe1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
28 changes: 16 additions & 12 deletions dist/drizzle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/contracts/contractsReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const contractsReducer = (state = initialState, action) => {
* Contract Status
*/

if (action.type === 'ADD_CONTRACT') {
if (action.type === 'CONTRACT_INITIALIZING') {
return {
...state,
[action.contractConfig.contractName]: generateContractInitialState(action.contractConfig)
Expand Down
1 change: 1 addition & 0 deletions src/contracts/contractsSaga.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export function* addContract({drizzle, contractConfig, events, web3}) {
// Prevents double-adding contracts
if (drizzle.loadingContract[contractConfig.contractName]) { return false }
drizzle.loadingContract[contractConfig.contractName] = true
yield put({type: 'CONTRACT_INITIALIZING', contractConfig})
let drizzleContract
if (contractConfig.web3Contract) {
drizzleContract = yield call(instantiateWeb3Contract, {web3Contract: contractConfig.web3Contract, name: contractConfig.contractName, events, store: drizzle.store, web3})
Expand Down

0 comments on commit 6ccdbe1

Please sign in to comment.