File tree 2 files changed +6
-3
lines changed
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -1979,9 +1979,10 @@ function _relayout(gd, aobj) {
1979
1979
var obji = ( componentArray || [ ] ) [ i ] || { } ;
1980
1980
var updateValObject = valObject || { editType : 'calc' } ;
1981
1981
1982
- if ( propStr === '' ) {
1982
+ if ( i !== '' && propStr === '' ) {
1983
1983
// special handling of undoit if we're adding or removing an element
1984
- // ie 'annotations[2]' which can be {...} (add) or null (remove)
1984
+ // ie 'annotations[2]' which can be {...} (add) or null,
1985
+ // does not work when replacing the entire array
1985
1986
if ( manageArrays . isAddVal ( vi ) ) {
1986
1987
undoit [ ai ] = null ;
1987
1988
} else if ( manageArrays . isRemoveVal ( vi ) ) {
@@ -1990,7 +1991,6 @@ function _relayout(gd, aobj) {
1990
1991
Lib . warn ( 'unrecognized full object value' , aobj ) ;
1991
1992
}
1992
1993
}
1993
-
1994
1994
editTypes . update ( flags , updateValObject ) ;
1995
1995
1996
1996
// prepare the edits object we'll send to applyContainerArrayChanges
Original file line number Diff line number Diff line change @@ -367,6 +367,8 @@ describe('Test shapes:', function() {
367
367
} ) ;
368
368
369
369
it ( 'can replace the shapes array' , function ( done ) {
370
+ spyOn ( Lib , 'warn' ) ;
371
+
370
372
Plotly . relayout ( gd , { shapes : [
371
373
getRandomShape ( ) ,
372
374
getRandomShape ( )
@@ -375,6 +377,7 @@ describe('Test shapes:', function() {
375
377
expect ( countShapePathsInLowerLayer ( ) ) . toEqual ( 0 ) ;
376
378
expect ( countShapePathsInSubplots ( ) ) . toEqual ( 0 ) ;
377
379
expect ( gd . layout . shapes . length ) . toBe ( 2 ) ;
380
+ expect ( Lib . warn ) . not . toHaveBeenCalled ( ) ;
378
381
} )
379
382
. catch ( failTest )
380
383
. then ( done ) ;
You can’t perform that action at this time.
0 commit comments