Add_root bokeh 3.0.3

I have successfully got my code updated to 3.0.3, but add_root doesn’t seem to update the live document.
In the debugging version of my code (which uses the eventhandler approach, so I can launch everything from python), I can see that this code

     for a_root in'tabs')):
     current_doc.add_root(bkm.Div(text='<div class="loader"></div>', name='tabs'))

which works in the 2.4 version of bokeh, indeed updates current_doc in 3.0.3 in the correct way, but there is no callback to the document being shown in the browser–it remains unchanged. In 2.4 it actually updates and refreshes.
Now it is entirely possible that I have missed something–or am making assumptions why this should be working in 2.4 that are in correct :slight_smile: .
Any hints to what I am missing would be much appreciated.

@Nirwa There was another topic or two related to this recently, unfortunately I don’t have time just now to go searching for them. IIRC there is some issue currently with dynamically adding/removing roots. The workaround is to add a single top level “container” such as a column once, up front, and then to add/remove its children.

It’s probably this curdoc.clear() doesn't work anymore on 3.x · Issue #12628 · bokeh/bokeh · GitHub issue. It’s about primarily clear(), but mentions add_root() as well.

1 Like

Sounds promising. Thanks Bryan and Mateusz: that was my direction of thinking as well.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.