Skip to content

Commit 9a341c1

Browse files
committed
mutate uid of expanded traces w.r.t to expanded index:
- so that the 'same' expanded trace keep the same uid on update.
1 parent 6a8e158 commit 9a341c1

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/plots/plots.js

+4
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,10 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout) {
657657
var expandedTrace = expandedTraces[j],
658658
fullExpandedTrace = plots.supplyTraceDefaults(expandedTrace, cnt, layout);
659659

660+
// mutate uid w.r.t to expanded index to promote consistency
661+
// between update calls.
662+
expandedTrace.uid = fullExpandedTrace.uid = fullTrace.uid + '-' + j;
663+
660664
// add info about parent data trace
661665
fullExpandedTrace.index = i;
662666
fullExpandedTrace._input = trace;

test/jasmine/tests/transforms_test.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,12 @@ describe('one-to-one transforms:', function() {
113113
it('Plotly.plot should plot the transform trace', function(done) {
114114
var data = Lib.extendDeep([], mockData0);
115115

116-
Plotly.plot(createGraphDiv(), data).then(function() {
116+
Plotly.plot(createGraphDiv(), data).then(function(gd) {
117117
assertDims([3]);
118118

119+
var uid = data[0].uid;
120+
expect(gd._fullData[0].uid).toEqual(uid + '-0');
121+
119122
done();
120123
});
121124
});

0 commit comments

Comments
 (0)