From 96b2ddeb8d36303da1969661554ef7b56c21eaa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Fri, 2 Sep 2016 14:20:25 -0400 Subject: [PATCH] mapbox: don't try to use plot method when trace module DNE - this handles the case where a 'visible: false' are passed in during the first plot call (the restyle case worked and works fine) - note 'that visible: false' traces do not get fullTrace._module during supply defaults. --- src/plots/mapbox/mapbox.js | 2 +- test/jasmine/tests/mapbox_test.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plots/mapbox/mapbox.js b/src/plots/mapbox/mapbox.js index 04bd1ba01f4..bee610b70eb 100644 --- a/src/plots/mapbox/mapbox.js +++ b/src/plots/mapbox/mapbox.js @@ -212,7 +212,7 @@ proto.updateData = function(calcData) { traceObj = traceHash[trace.uid]; if(traceObj) traceObj.update(calcTrace); - else { + else if(trace._module) { traceHash[trace.uid] = trace._module.plot(this, calcTrace); } } diff --git a/test/jasmine/tests/mapbox_test.js b/test/jasmine/tests/mapbox_test.js index 29df105616f..f0fe06c5b25 100644 --- a/test/jasmine/tests/mapbox_test.js +++ b/test/jasmine/tests/mapbox_test.js @@ -295,6 +295,12 @@ describe('mapbox plots', function() { }).then(function() { expect(countVisibleTraces(gd, modes)).toEqual(2); + mock.data[0].visible = false; + + return Plotly.newPlot(gd, mock.data, mock.layout); + }).then(function() { + expect(countVisibleTraces(gd, modes)).toEqual(1); + done(); }); });