Skip to content

Commit 43113c9

Browse files
committed
Promises: Ensure all gd._promises resolve before final resolve
1 parent df5f58e commit 43113c9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/plot_api/plot_api.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ Plotly.plot = function(gd, data, layout, config) {
320320
gd.emit('plotly_afterplot');
321321
}
322322

323-
var donePlotting = Lib.syncOrAsync([
323+
Lib.syncOrAsync([
324324
Plots.previousPromises,
325325
marginPushers,
326326
marginPushersAgain,
@@ -333,8 +333,9 @@ Plotly.plot = function(gd, data, layout, config) {
333333

334334
// even if everything we did was synchronous, return a promise
335335
// so that the caller doesn't care which route we took
336-
return (donePlotting && donePlotting.then) ?
337-
donePlotting : Promise.resolve(gd);
336+
return Promise.all(gd._promises).then(function() {
337+
return gd;
338+
});
338339
};
339340

340341
// Get the container div: we store all variables for this plot as

0 commit comments

Comments
 (0)