Skip to content

fix: Clear a stale _inputRange when Plotly.react or a whole axis object sets a new range - #8144

Open
Roshan1299 wants to merge 2 commits into
plotly:mainfrom
Roshan1299:fix/8110-react-input-range
Open

Roshan1299 wants to merge 2 commits into
plotly:mainfrom
Roshan1299:fix/8110-react-input-range

Conversation

@Roshan1299

Copy link
Copy Markdown

Fixes #8110. Plotly.react, and Plotly.relayout with a whole axis object, now draw a new range on an axis with constrain: 'domain', as Plotly.newPlot and the dotted relayout keys do.

Why it's right: constraints.enforce compares the range with _inputRange, and when the range is smaller it puts _inputRange back. The dotted relayout keys clear _inputRange. react and a whole axis object did not, so the previous range came back.

Tests: five cases in axes_test.js (constraints relayout), with the layout from the issue. With plot_api.js at main, three fail (react, a whole axis object with both ranges, a whole axis object with one range); the dotted single-range case and "same layout again" pass on both, as controls.

Suites run locally (Chrome 155, macOS): axes 406 of 407, plot_api_react 113, plot_api 171, cartesian 20, cartesian_interact 75 of 76. The two failures (insiderange react to new data, multicategory tick label span during drag) fail the same way with plot_api.js at main.

The "same layout again" branch (a range that equals the drawn range but not _inputRange) has no test of its own; it mirrors the _inputDomain branch above it.

I didn't run the image tests: the change only touches react and relayout, and no mock was added or changed.

…ct sets a new range

On a constrain:'domain' axis, constraints.enforce compares the range
with _inputRange and puts _inputRange back when the range is smaller.
Plotly.react and Plotly.relayout with a whole axis object kept the old
_inputRange, so a new range drew as the previous one. diffLayout now
clears it the way it clears _inputDomain, and the whole axis object
case does what the dotted range keys already do.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

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.

[BUG]: Plotly.react ignores a new axis range on a scaleanchor + constrain:'domain' axis (stale _inputRange)

1 participant