Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"no-trailing-spaces": [2],
"no-multiple-empty-lines": [2, {"max": 2, "maxEOF": 0}],
"eol-last": [2],
"linebreak-style": [2, "unix"],
"indent": [2, 4, {"SwitchCase": 1}],
"max-len": [0, 80],
"brace-style": [0, "stroustrup", {"allowSingleLine": true}],
Expand Down
6 changes: 6 additions & 0 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Contributor

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?

Copy link
Contributor

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)

Copy link
Contributor

Choose a reason for hiding this comment

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

@dfcreative now that the desired behavior is confirmed. before merging:

TODO

image

  • add test case in this suite

Copy link
Contributor

Choose a reason for hiding this comment

The 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!)
Expand Down