Skip to content

Commit acc98b2

Browse files
committed
clear _indexToPoints in case it got relinked
1 parent 016f6f9 commit acc98b2

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/plots/plots.js

+2
Original file line numberDiff line numberDiff line change
@@ -2514,6 +2514,8 @@ plots.doCalcdata = function(gd, traces) {
25142514

25152515
if(trace.visible === true) {
25162516

2517+
// clear existing ref in case it got relinked
2518+
delete trace._indexToPoints;
25172519
// keep ref of index-to-points map object of the *last* enabled transform,
25182520
// this index-to-points map object is required to determine the calcdata indices
25192521
// that correspond to input indices (e.g. from 'selectedpoints')

test/jasmine/tests/transform_filter_test.js

+23
Original file line numberDiff line numberDiff line change
@@ -1274,4 +1274,27 @@ describe('filter transforms interactions', function() {
12741274
.then(done);
12751275
});
12761276

1277+
it('should clear indexToPoints on removal', function(done) {
1278+
var gd = createGraphDiv();
1279+
1280+
Plotly.react(gd, [{
1281+
y: [1, 2, 3, 1, 2, 3],
1282+
transforms: [{
1283+
type: 'filter',
1284+
target: 'y',
1285+
operation: '<',
1286+
value: 3
1287+
}]
1288+
}])
1289+
.then(function() {
1290+
expect(gd._fullData[0]._indexToPoints).toEqual({0: [0], 1: [1], 2: [3], 3: [4]});
1291+
return Plotly.react(gd, [{ y: [1, 2, 3, 1, 2, 3] }]);
1292+
})
1293+
.then(function() {
1294+
expect(gd._fullData[0]._indexToPoints).toBeUndefined();
1295+
})
1296+
.catch(failTest)
1297+
.then(done);
1298+
});
1299+
12771300
});

0 commit comments

Comments
 (0)