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

Extend input relayout & restyle objects before looping over key-vals #1376

Merged
merged 2 commits into from Feb 15, 2017

Conversation

etpinard
Copy link
Contributor

fixes https://github.com/plotly/streambed/issues/9172

In a few cases, given:

Plotly.relayout(gd, updateObj)

// or
Plotly.update(gd, {}, updateObj)

the input updateObj is mutated by the relayout logic while converting aliases for example here when relayout'ing annotations.

This bug became very problematic for update menu buttons relayout annotations (example) where it caused the buttons to stop working after repeated clicks.

Note that, the restyle object - i.e. as in Plotly.restyle(gd, restyleObject, traces) - are never mutated. In this PR, I chose to extend them anyway in case we do start mutating them down the road.

- so that if key-vals need to be mapped
  (this happens for annotations relayout calls), the input
  object doesn't get mutated.
@alexcjohnson
Copy link
Contributor

Good call 💃

@etpinard etpinard merged commit 190b3b5 into master Feb 15, 2017
@etpinard etpinard deleted the relayout-annotations-mutation-guard branch February 15, 2017 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants