Skip to content
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

multiplying events #2504

Closed
bmaranville opened this issue Feb 2, 2024 · 1 comment · Fixed by #2505
Closed

multiplying events #2504

bmaranville opened this issue Feb 2, 2024 · 1 comment · Fixed by #2505
Labels
bug Something isn't working
Milestone

Comments

@bmaranville
Copy link
Contributor

Description

  1. I want to listen for a click event on one plotly plot, then use that to update a second plotly plot.
  2. I expect the on('plotly_click', ...) handler to fire exactly once for each click
  3. Instead, the handler fires 3x on the first click, then 4x on the second click, then 5x ... etc.

Here is code to reproduce the issue:

from nicegui import ui
import plotly.graph_objects as go

fig = go.Figure(go.Scatter(x=[0,1,2,3,4], y=[3,5,2,7,8]))
plot = ui.plotly(fig)

fig2 = go.Figure(go.Scatter(x=[0,1,2,3,4], y=[2,5,1,2,1]))
plot2 = ui.plotly(fig2)

def click_handler(ev):
    plot2.update()
    print(ev.args)

plot.on("plotly_click", click_handler)
ui.run()
@platinops
Copy link

I believe this same bug also causes #2435

@falkoschindler falkoschindler added this to the 1.4.14 milestone Feb 4, 2024
@falkoschindler falkoschindler added the bug Something isn't working label Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants