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

Clear inputDomain in diffLayout #7283

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

marthacryan
Copy link
Collaborator

@marthacryan marthacryan commented Nov 22, 2024

Alternative fix to plotly/plotly.py#4794. Other fix is #7282.

Context:

  • @alexcjohnson noted that Fix: Switch template edit type to plot #7282 didn't seem like the right fix because changing editType from 'calc' to 'plot' is more of a downgrade than something that should fix this issue.
  • I pointed out this particular line should be resetting the _inputDomain, but that this line was returning in diffFlags before it reached the yaxis to reset it
  • Alex said that the fact that we're resetting _inputDomain in the changed function was actually incorrect. It should be reset in its own separate crawl of the layout.
  • We decided to put the reset of _inputDomain into the diffLayout function because it has access to both the old layout and the new layout.

newFullLayout[key].domain = oldFullLayout[key].domain;
} else if (newDomain[0] !== oldDomain[0] || newDomain[1] !== oldDomain[1]) {
// what you're asking for HAS changed, so clear _inputDomain and let us start from scratch
newFullLayout[key]._inputDomain = null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think nestedProperty(...).set(null) is actually equivalent to delete newFullLayout[key]._inputDomain

Copy link
Contributor

Choose a reason for hiding this comment

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

@alexcjohnson Using delete may be slower comparing to setting to null. No?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I suppose that’s faster and should be equivalent. This is not a high volume operation so I wouldn’t be too concerned about it, but we can leave it if you prefer.

@archmoj
Copy link
Contributor

archmoj commented Nov 25, 2024

@marthacryan Thanks very much for another excellent PR. 🏆
Please use Fix: prefix in the PR title and also add a draft log.
You may also consider revisiting the PR title so that it reflects the fix from the user's perspective.

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