question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] TypeError after replacing tools on a toolbar

See original GitHub issue

My plot should have different sets of tools depending on what is displayed. setting plot.toolbar doesn’t help since the toolbar model change not not handled correctly. Executing something like plot.toolbar.tools = new_tools_list seems to work but results in this exception in JS console:

bokeh.js:30582 Uncaught TypeError: Cannot read property 'el' of undefined
    at el (bokeh.js:30582)
    at Array.map (<anonymous>)
    at ToolbarBaseView.render (bokeh.js:30586)
    at ToolbarPanelView.render (bokeh.js:11764)
    at PlotView._paint_levels (bokeh.js:22064)
    at PlotView.paint (bokeh.js:22044)
    at PlotView.repaint (bokeh.js:21983)
    at PlotView.<anonymous> (bokeh.js:21892)
    at Signal0.Signal.emit (bokeh.js:4167)
    at Signal0.emit (bokeh.js:4180)

Both Toolbar and ToolbarBaseView attach a signal on the tools property change. However, the Toolbar.gestures property change does not remove the old references:

// Toolbar._init_tools()
if (!some(this.gestures[et].tools, (t) => t.id == tool.id))
  this.gestures[et].tools = this.gestures[et].tools.concat([tool])

Because of this, only the addition of tools works without errors. And while gestures is a property in BokehJS, it is not in the Python counterpart.

Similar code can be seen in ProxyToolbar but it doesn’t handle the changes to the list of tools at all, so I guess it was never on the plate.

While it’s not reflected in the error above, other attributes have the same issue of not being pruned on tools change: inspectors, help, actions.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
p-himikcommented, Jul 15, 2019

It will be a bit more intrusive since a proper fix would also change ProxyToolbar. I’ll come up with a PR soon.

0reactions
p-himikcommented, Jul 15, 2019

Seems to work fine now.

@bryevdv Oh no, sorry for that rant. I completely get the virtues TS provides for projects similar to Bokeh (big code base, multiple contributors from different backgrounds). It’s just that I’m mostly used to writing code for other kinds of projects, with no such needs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bug]: wxGUI crash at launch: TypeError: ToolBar.AddTool ...
I backported a change to 7.8, that uses a different widget so the problem doesn't come up. Ultimately we need a new 7.8...
Read more >
Uncaught TypeError: toolbar.on is not a function
I am new to ArcGIS, and I just started with letting my app able to draw on the map various shapes. I keep...
Read more >
Setting CKEditor toolbar configuration on pageload results in ...
I'm getting Uncaught TypeError: undefined is not a function in the console, but I don't know why. I currently have this code which...
Read more >
replies - Mozilla Support
I am constantly getting the following error message ... what happened:TypeError: Components.classes['@mozilla.org/extensions/manager;1'] is ...
Read more >
Sub-menus from Entity Toolbar module not expanded on hover
Problem /Motivation Sub-menus from Entity Toolbar module are not expanded on hover after Admin Toolbar upgrade from 8.x-2.x to 3.x.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found