@@ -326,10 +326,6 @@ Plotly.plot = function(gd, data, layout, config) {
326326 // so that the caller doesn't care which route we took
327327 return Promise . all ( gd . _promises ) . then ( function ( ) {
328328 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 = [ ] ;
333329 } ) ;
334330} ;
335331
@@ -355,6 +351,12 @@ function getGraphDiv(gd) {
355351 return gd ; // otherwise assume that gd is a DOM element
356352}
357353
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+
358360function opaqueSetBackground ( gd , bgColor ) {
359361 gd . _fullLayout . _paperdiv . style ( 'background' , 'white' ) ;
360362 Plotly . defaultConfig . setBackground ( gd , bgColor ) ;
@@ -1536,6 +1538,7 @@ Plotly.moveTraces = function moveTraces(gd, currentIndices, newIndices) {
15361538// style files that want to specify cyclical default values).
15371539Plotly . restyle = function restyle ( gd , astr , val , traces ) {
15381540 gd = getGraphDiv ( gd ) ;
1541+ clearPromiseQueue ( gd ) ;
15391542
15401543 var i , fullLayout = gd . _fullLayout ,
15411544 aobj = { } ;
@@ -2076,6 +2079,7 @@ function swapXYData(trace) {
20762079// allows setting multiple attributes simultaneously
20772080Plotly . relayout = function relayout ( gd , astr , val ) {
20782081 gd = getGraphDiv ( gd ) ;
2082+ clearPromiseQueue ( gd ) ;
20792083
20802084 if ( gd . framework && gd . framework . isPolar ) {
20812085 return Promise . resolve ( gd ) ;
0 commit comments