Skip to content

Avoid full replot on card resize - #635

Open
rosenrot00 wants to merge 1 commit into
dbuezas:masterfrom
rosenrot00:resize-without-replot
Open

Avoid full replot on card resize#635
rosenrot00 wants to merge 1 commit into
dbuezas:masterfrom
rosenrot00:resize-without-replot

Conversation

@rosenrot00

@rosenrot00 rosenrot00 commented Jul 30, 2026

Copy link
Copy Markdown
  • replace the ResizeObserver's full plot() path with a lightweight Plotly.relayout() for changed automatic dimensions
  • skip resize work when the measured size is unchanged or the card is hidden
  • preserve explicitly configured layout.width and layout.height
  • keep the full render path as a fallback when an automatic dimension is removed

Every ResizeObserver notification currently calls plot({ should_fetch: false }). Although it does not fetch history, it still merges and evaluates the full configuration, processes cached data, and calls Plotly.react().

Plotly.Plots.resize() cannot be used for the common card layout because Plotly deliberately treats it as a no-op when both layout width and height are set. Updating only the changed dimensions through Plotly.relayout() avoids rebuilding traces while preserving the existing explicit sizing behavior.

This PR is independent of #634.

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.

1 participant