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

Improve the update mechanism for ui.plotly #4317

Merged
merged 1 commit into from
Feb 7, 2025
Merged

Conversation

falkoschindler
Copy link
Contributor

This PR tries to solve #4186 by calling the update() method in JavaScript explicitly rather than within the updated hook. It seems to resolve the problem described with the following code snippet:

ui.label('1. Manually zoom the plot')
ui.button('2. Update the label', on_click=lambda: label.set_text(label.text + '.'))
ui.button('3. Update the plot', on_click=lambda: plot.update())
ui.label('4. --> The plot resets unexpectedly')

label = ui.label('...')
plot = ui.plotly({'layout': {'uirevision': 'constant'}})

Tests are passing and demos seem to work like before.

@falkoschindler falkoschindler added the bug Something isn't working label Feb 7, 2025
@falkoschindler falkoschindler added this to the 2.12 milestone Feb 7, 2025
@falkoschindler falkoschindler requested a review from rodja February 7, 2025 15:00
@falkoschindler falkoschindler changed the title improve update of ui.plotly Improve the update mechanism for ui.plotly Feb 7, 2025
@falkoschindler falkoschindler merged commit 509faa9 into main Feb 7, 2025
9 checks passed
@falkoschindler falkoschindler deleted the plotly-update branch February 7, 2025 18:09
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 this pull request may close these issues.

Introducing an updating text label causes inadvertent plotly figure reset
2 participants