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

Allow empty drizzleOptions #198

Closed
rahulmutt opened this issue Mar 21, 2019 · 1 comment · Fixed by #201
Closed

Allow empty drizzleOptions #198

rahulmutt opened this issue Mar 21, 2019 · 1 comment · Fixed by #201

Comments

@rahulmutt
Copy link
Contributor

In my use-case, I didn't need to initialize the options (since I am dynamically adding contracts) so I sent an empty object to DrizzleProvider from drizzle-react and I got the following error:

generateContractsInitialState
node_modules/drizzle/dist/drizzle.js:18320
  18317 | // Preloaded state
  18318 | var contractsInitialState = {};
  18319 | 
> 18320 | for (var i = 0; i < options.contracts.length; i++) {
        | ^  18321 |   // Initial contract details
  18322 |   var contractName = options.contracts[i].contractName;
  18323 |   contractsInitialState[contractName] = (0, _generateContractInitialState.generateContractInitialState)(options.contracts[i]);

which seems to be coming from core drizzle.

The workaround is to send:

{ contracts: [] }

Happy to submit a PR if a fix is desirable.

@cds-amal
Copy link
Member

Thanks for raising this @rahulmutt ! Would appreciate a PR

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants