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

fix: check if update_data contains update before batch_update #316

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

jvdd
Copy link
Member

@jvdd jvdd commented Aug 25, 2024

When using FigureWidgetResampler using traces that are not resampled (e.g., Histogram, Bar, etc.), the following action chain resulted in a TypeError (because update_data is NoUpdate)

  1. Zoom in in a region
  2. Reset the axis (house icon)

Reproducible code:

import numpy as np
from plotly_resampler import FigureWidgetResampler

x = np.random.randn(100)
fig = FigureWidgetResampler(go.Figure(go.Histogram(x=x)))
fig

Error ⬇️
image

@jvdd jvdd requested a review from jonasvdd August 25, 2024 12:27
Comment on lines +268 to +273
# Also: Remove the showspikes from the layout, otherwise the autorange
# will not work as intended (it will not be triggered again)
# Note: this removal causes a second trigger of this method
# which will go in the "else" part below.
for xaxis_str in self._xaxis_list:
self.layout[xaxis_str].pop("showspikes")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not 100% sure whether this is necessary when update_data is NoUpdate
(In the previous logic, this would be executed)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite sure it is correct to only execute this code if update_data is a proper update.

@codecov-commenter
Copy link

codecov-commenter commented Aug 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.38%. Comparing base (f58db50) to head (b2f9975).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #316      +/-   ##
==========================================
- Coverage   96.49%   92.38%   -4.12%     
==========================================
  Files          14       13       -1     
  Lines        1141     1129      -12     
==========================================
- Hits         1101     1043      -58     
- Misses         40       86      +46     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jonasvdd jonasvdd self-assigned this Sep 2, 2024
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 this pull request may close these issues.

3 participants