Black Lives Matter. Please consider donating to Black Girls Code today.

Dash DataTable javascript error: "TypeError: Cannot read property 'state' of null"

I am getting an error sometimes… I think when my table is empty/not yet populated and something in javascript is trying to access it. Does anyone have advice for how to avoid this… not sure if this is something i need to initialize always on my side/ or if is this something that can be avoid by checking for null grid in dash code.

Uncaught (in promise) TypeError: Cannot read property ‘state’ of null
at t.value (bundle.js?v=0.5.5:formatted:4486)
at p.updateComponent (react-dom@15.4.2.min.js?v=0.11.2:formatted:2302)
at p.receiveComponent (react-dom@15.4.2.min.js?v=0.11.2:formatted:2288)
at Object.receiveComponent (react-dom@15.4.2.min.js?v=0.11.2:formatted:4788)
at p._updateRenderedComponent (react-dom@15.4.2.min.js?v=0.11.2:formatted:2350)
at p._performComponentUpdate (react-dom@15.4.2.min.js?v=0.11.2:formatted:2341)
at p.updateComponent (react-dom@15.4.2.min.js?v=0.11.2:formatted:2308)
at p.receiveComponent (react-dom@15.4.2.min.js?v=0.11.2:formatted:2288)
at Object.receiveComponent (react-dom@15.4.2.min.js?v=0.11.2:formatted:4788)
at p._updateRenderedComponent (react-dom@15.4.2.min.js?v=0.11.2:formatted:2350)

the bundle.js code where grid is null and trying to reference “state” is here:

        key: "componentWillReceiveProps",
        value: function(e) {
            this.propsToState(e, this.props),
            **this.grid.state.canFilter && this.grid.onToggleFilter()**
        }

4 posts were split to a new topic: Errors using Dash with custom javascript and postMessage