@@ -2737,16 +2737,6 @@ function react(gd, data, layout, config) {
2737
2737
2738
2738
applyUIRevisions ( gd . data , gd . layout , oldFullData , oldFullLayout ) ;
2739
2739
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
-
2750
2740
// "true" skips updating calcdata and remapping arrays from calcTransforms,
2751
2741
// which supplyDefaults usually does at the end, but we may need to NOT do
2752
2742
// if the diff (which we haven't determined yet) says we'll recalc
@@ -2772,10 +2762,22 @@ function react(gd, data, layout, config) {
2772
2762
2773
2763
if ( updateAutosize ( gd ) ) relayoutFlags . layoutReplot = true ;
2774
2764
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
+ }
2777
2777
// 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
+ }
2779
2781
2780
2782
// Note: what restyle/relayout use impliedEdits and clearAxisTypes for
2781
2783
// must be handled by the user when using Plotly.react.
0 commit comments