-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Clone input trace #1136
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
Clone input trace #1136
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -956,6 +956,12 @@ Plotly.addTraces = function addTraces(gd, traces, newIndices) { | |
if(!Array.isArray(traces)) { | ||
traces = [traces]; | ||
} | ||
|
||
// make sure traces do not repeat existing ones | ||
traces = traces.map(function(trace) { | ||
return Lib.extendFlat({}, trace); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dfcreative now that the desired behavior is confirmed. before merging: TODO
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dfcreative I'd love to get this fix in the next patch release. Are you available to ✅ the TODO list above today? If not, no rush, I'll gladly take over this PR. |
||
}); | ||
|
||
helpers.cleanData(traces, gd.data); | ||
|
||
// add the traces to gd.data (no redrawing yet!) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dfcreative Thanks for looking into 🍻 I believe this leads to the desired behaviour. We'll wait for @cpsievert to reply to #1083 (comment) to confirm though.
Do you know exactly why passing existing trace objects to
addTraces
cause an infinite loop?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Desired behavior confirmed in #1083 (comment)