@@ -2737,16 +2737,6 @@ function react(gd, data, layout, config) {
27372737
27382738 applyUIRevisions ( gd . data , gd . layout , oldFullData , oldFullLayout ) ;
27392739
2740- var allNames = Object . getOwnPropertyNames ( oldFullLayout ) ;
2741- for ( var q = 0 ; q < allNames . length ; q ++ ) {
2742- var name = allNames [ q ] ;
2743- var start = name . substring ( 0 , 5 ) ;
2744- if ( start === 'xaxis' || start === 'yaxis' ) {
2745- var emptyCategories = oldFullLayout [ name ] . _emptyCategories ;
2746- if ( emptyCategories ) emptyCategories ( ) ;
2747- }
2748- }
2749-
27502740 // "true" skips updating calcdata and remapping arrays from calcTransforms,
27512741 // which supplyDefaults usually does at the end, but we may need to NOT do
27522742 // if the diff (which we haven't determined yet) says we'll recalc
@@ -2772,10 +2762,22 @@ function react(gd, data, layout, config) {
27722762
27732763 if ( updateAutosize ( gd ) ) relayoutFlags . layoutReplot = true ;
27742764
2775- // clear calcdata if required
2776- if ( restyleFlags . calc || relayoutFlags . calc ) gd . calcdata = undefined ;
2765+ // clear calcdata and empty categories if required
2766+ if ( restyleFlags . calc || relayoutFlags . calc ) {
2767+ gd . calcdata = undefined ;
2768+ var allNames = Object . getOwnPropertyNames ( newFullLayout ) ;
2769+ for ( var q = 0 ; q < allNames . length ; q ++ ) {
2770+ var name = allNames [ q ] ;
2771+ var start = name . substring ( 0 , 5 ) ;
2772+ if ( start === 'xaxis' || start === 'yaxis' ) {
2773+ var emptyCategories = newFullLayout [ name ] . _emptyCategories ;
2774+ if ( emptyCategories ) emptyCategories ( ) ;
2775+ }
2776+ }
27772777 // otherwise do the calcdata updates and calcTransform array remaps that we skipped earlier
2778- else Plots . supplyDefaultsUpdateCalc ( gd . calcdata , newFullData ) ;
2778+ } else {
2779+ Plots . supplyDefaultsUpdateCalc ( gd . calcdata , newFullData ) ;
2780+ }
27792781
27802782 // Note: what restyle/relayout use impliedEdits and clearAxisTypes for
27812783 // must be handled by the user when using Plotly.react.
0 commit comments