Skip to content

Bug - global resize handlers are not removed with FigureWidget() #3100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
asaff1 opened this issue Mar 4, 2021 · 0 comments · Fixed by #3805
Closed

Bug - global resize handlers are not removed with FigureWidget() #3100

asaff1 opened this issue Mar 4, 2021 · 0 comments · Fixed by #3805

Comments

@asaff1
Copy link

asaff1 commented Mar 4, 2021

To reproduce, execute the following code in a cell a few times:
go.FigureWidget()
Then try to resize the window. You will notice the following console errors:
image

However, when doing the same with go.Figure(), the problem does not occur. The console logs shows that plotly does detect a notebook cell get destroyed.
image

I need to use the go.FigureWidget(), because I can update it later in a another notebook cell. I need this functionality since I use my notebook to render a web application using Voila, and I need the plots to be rendered in specific cells.

Is there an option to use go.Figure() and to update it in a another cell?
Or to somehow make FigureWidget() to unbind resize handlers?

maartenbreddels added a commit to maartenbreddels/plotly.py that referenced this issue Jul 7, 2022
Fixes plotly#3100

If this is not cleaned up, we see a lot of stacktraces in the JS console:

index.js?v=20220623202309:2 Uncaught (in promise) Error: Resize must be passed a displayed plot div element.
    at index.js?v=20220623202309:2:2385247
    at new Promise (<anonymous>)
    at b.resize (index.js?v=20220623202309:2:2385199)
    at h.autosizeFigure (index.js?v=20220623202309:2:3736430)
    at index.js?v=20220623202309:2:3736222

Also, the destroy methods is renamed to remove. Destroy will never be
called, but remove is.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant