Repository navigation
Prevent internal _template leak into layout rangeslider opp-axis (#6310) - #8161
Open
davrens101 wants to merge 2 commits into
Open
davrens101 wants to merge 2 commits into
davrens101 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prevent internal _template leak into layout rangeslider opp-axis
Fixes #6310.
When an axis with a rangeslider autoranges in
doAutoRange(src/plots/cartesian/autorange.js),axeRangeOptsfor each opposing axis is copied back intoanchorAx._input.rangeslider[ax._name]. BecauseaxeRangeOptsis instantiated viaTemplate.newContainerinrangeslider/defaults.js, it contains an internal_templateproperty (eithernullor a template object). Copying the whole object intoanchorAx._inputpollutes the user-facinglayoutobject with_template: nullunderrangeslider[yaxis].This non-schema property causes serialization and validation failures in downstream consumers such as Dash Python (
ValueError: Invalid property specified for object of type plotly.graph_objs.layout.xaxis.rangeslider.YAxis: '_template').Solution
Delete
_templatefrom the copied options object before assigning back toanchorAx._input.rangeslider[ax._name]. The internal_templateproperty remains intact on_fullLayoutas expected.Regression coverage
Added two unit tests in
test/jasmine/tests/range_slider_test.js:should not leak _template into input layout rangeslider opp-axis containershould not leak _template into input layout when a template is usedPrior to the fix:
expect(gd.layout.xaxis.rangeslider.yaxis._template).toBeUndefined()failed withError: Expected null to be undefined.With the fix:
Both tests pass cleanly.
template_test.jspasses 14 of 14 tests. Biome linter passes without warnings.Review and disclosure
AI assisted the patch, regression tests, and PR description. Verified against Jasmine test suite and Biome linter.