-
-
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
Conversation
|
||
// 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 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)
|
||
// 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 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
- rewrite
.map
as for-loop. Good old for-loop are apparently much faster than functional calls at least in Chrome. From our latest estimates in https://github.com/plotly/streambed/pull/8395#discussion_r86844172:
- add test case in this suite
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 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.
Obsolete by #1175 |
This fixes #1083.
I guess making sure that input trace data for
addTraces
is cloned, at least in shallow fashion, is a good move.