@@ -2811,6 +2811,32 @@ function diffLayout(gd, oldFullLayout, newFullLayout, immutable, transition) {
28112811 return PlotSchema . getLayoutValObject ( newFullLayout , parts ) ;
28122812 }
28132813
2814+ // Clear out any _inputDomain that's no longer valid
2815+ for ( var key in newFullLayout ) {
2816+ if ( ! key . startsWith ( 'xaxis' ) && ! key . startsWith ( 'yaxis' ) ) {
2817+ continue ;
2818+ }
2819+ if ( ! oldFullLayout [ key ] ) {
2820+ continue ;
2821+ }
2822+ var newDomain = newFullLayout [ key ] . domain ;
2823+ var oldDomain = oldFullLayout [ key ] . domain ;
2824+ var oldInputDomain = oldFullLayout [ key ] . _inputDomain ;
2825+ if ( oldFullLayout [ key ] . _inputDomain ) {
2826+ if ( newDomain [ 0 ] === oldInputDomain [ 0 ] && newDomain [ 1 ] === oldInputDomain [ 1 ] ) {
2827+ // what you're asking for hasn't changed, so let plotly.js start with what it
2828+ // concluded last time and iterate from there
2829+ newFullLayout [ key ] . domain = oldFullLayout [ key ] . domain ;
2830+ } else if ( newDomain [ 0 ] !== oldDomain [ 0 ] || newDomain [ 1 ] !== oldDomain [ 1 ] ) {
2831+ // what you're asking for HAS changed, so clear _inputDomain and let us start from scratch
2832+ newFullLayout [ key ] . _inputDomain = null ;
2833+ }
2834+ // We skip the else case (newDomain !== oldInputDomain && newDomain === oldDomain)
2835+ // because it's likely that if the newDomain and oldDomain are the same, the user
2836+ // passed in the same layout object and we should keep the _inputDomain.
2837+ }
2838+ }
2839+
28142840 var diffOpts = {
28152841 getValObject : getLayoutValObject ,
28162842 flags : flags ,
@@ -2863,11 +2889,6 @@ function getDiffFlags(oldContainer, newContainer, outerparts, opts) {
28632889 flags . rangesAltered [ outerparts [ 0 ] ] = 1 ;
28642890 }
28652891
2866- // clear _inputDomain on cartesian axes with altered domains
2867- if ( AX_DOMAIN_RE . test ( astr ) ) {
2868- nestedProperty ( newContainer , '_inputDomain' ) . set ( null ) ;
2869- }
2870-
28712892 // track datarevision changes
28722893 if ( key === 'datarevision' ) {
28732894 flags . newDataRevision = 1 ;
0 commit comments