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

TypeError: Cannot read property 'block' of undefined #13

Closed
artemarta opened this issue Apr 6, 2018 · 4 comments
Closed

TypeError: Cannot read property 'block' of undefined #13

artemarta opened this issue Apr 6, 2018 · 4 comments

Comments

@artemarta
Copy link

Everything has been done according to official docs.
But I've got an error.
I think it's because in https://github.com/trufflesuite/drizzle-react/blob/master/src/DrizzleProvider.js on line 29 there is no check whether web3 property exists on options object.

I have the following code:

import Token from './contracts/StandardToken.json';

export const drizzleOptions = {
    contracts: [Token],
};
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { DrizzleProvider } from 'drizzle-react';
import { initializeIcons } from '@uifabric/icons';
import { Fabric } from 'office-ui-fabric-react/lib/Fabric';
import { store } from './store';
import { AppRouter } from './router';
import { unregister as unregisterServiceWorker } from './registerServiceWorker';
import { drizzleOptions } from './drizzleOptions';

import './index.css';

initializeIcons();

const withProvider = WrappedComponent => (
    <Fabric>
        <DrizzleProvider options={drizzleOptions}>
            <Provider store={store}>
                <WrappedComponent />
            </Provider>
        </DrizzleProvider>
    </Fabric>
);

ReactDOM.render(withProvider(AppRouter), document.getElementById('root'));
unregisterServiceWorker();
@sliptype
Copy link

Same issue here, got it working thanks to @artemarta by adding web3.block to my options:

web3: {
    block: false
}

I'm not sure what the use-case is for block and I couldn't find anything in the docs about it, but I'm thinking web3 should be null checked

@wangki
Copy link

wangki commented Apr 20, 2018

@sklingler93 That doesn't work for me. My option
web3: { block: false, fallback: { type: "ws", url: "ws://127.0.0.1:7545" } }

@wangki
Copy link

wangki commented Apr 20, 2018

add polls: {}, works perfect. what happened here?

Refer to : trufflesuite/drizzle#32

@OnlyOneJMJQ
Copy link
Contributor

This is caused by a combination of things that have now been patched:

  • The options checks were assuming some key existence, now drizzle comes with sensible default options as of release v1.1.4.
  • The block options this is checking for was vestigial and should have been removed, it now is as of drizzle-react release v1.1.1.

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

No branches or pull requests

4 participants