-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Modebar button click function does not update on rerender #5796
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
Comments
Hello, I'm also facing the same issue with the latest version (2.27.0). It seems like this is still a bug within |
@vdgodse Can you please add the |
I believe I have a found a workaround for this. When calculating whether to redraw the modebar or not, plotly compares the buttons via their name propery. So if you do some thing like:
It will redraw the |
Hi - we are tidying up stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for a while, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. If you'd like to submit a PR, we'd be happy to prioritize a review, and if it's a request for tech support, please post in our community forum. Thank you - @gvwilson |
https://codepen.io/vdgodse/pen/ExmjGLN
In plotly we can provide config as: modeBarButtonsToAdd: [
{
name: 'button1',
icon: Plotly.Icons.pencil,
direction: 'up',
click: function(gd) {
// this does not update on rerender and always holds the stale react state in closure as shown in the codepen demo
}
}],
Click on the pencil icon to see alert with realCount and staleCount. Since second click the counts diverge.
The text was updated successfully, but these errors were encountered: