@@ -326,10 +326,6 @@ Plotly.plot = function(gd, data, layout, config) {
326
326
// so that the caller doesn't care which route we took
327
327
return Promise . all ( gd . _promises ) . then ( function ( ) {
328
328
return gd ;
329
- } , function ( ) {
330
- // clear the promise queue if one of them got rejected
331
- Lib . log ( 'Clearing previous rejected promises from queue.' ) ;
332
- gd . _promises = [ ] ;
333
329
} ) ;
334
330
} ;
335
331
@@ -355,6 +351,12 @@ function getGraphDiv(gd) {
355
351
return gd ; // otherwise assume that gd is a DOM element
356
352
}
357
353
354
+ // clear the promise queue if one of them got rejected
355
+ function clearPromiseQueue ( gd ) {
356
+ Lib . log ( 'Clearing previous rejected promises from queue.' ) ;
357
+ gd . _promises = [ ] ;
358
+ }
359
+
358
360
function opaqueSetBackground ( gd , bgColor ) {
359
361
gd . _fullLayout . _paperdiv . style ( 'background' , 'white' ) ;
360
362
Plotly . defaultConfig . setBackground ( gd , bgColor ) ;
@@ -1536,6 +1538,7 @@ Plotly.moveTraces = function moveTraces(gd, currentIndices, newIndices) {
1536
1538
// style files that want to specify cyclical default values).
1537
1539
Plotly . restyle = function restyle ( gd , astr , val , traces ) {
1538
1540
gd = getGraphDiv ( gd ) ;
1541
+ clearPromiseQueue ( gd ) ;
1539
1542
1540
1543
var i , fullLayout = gd . _fullLayout ,
1541
1544
aobj = { } ;
@@ -2076,6 +2079,7 @@ function swapXYData(trace) {
2076
2079
// allows setting multiple attributes simultaneously
2077
2080
Plotly . relayout = function relayout ( gd , astr , val ) {
2078
2081
gd = getGraphDiv ( gd ) ;
2082
+ clearPromiseQueue ( gd ) ;
2079
2083
2080
2084
if ( gd . framework && gd . framework . isPolar ) {
2081
2085
return Promise . resolve ( gd ) ;
0 commit comments