File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 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) {
19791979 var obji = ( componentArray || [ ] ) [ i ] || { } ;
19801980 var updateValObject = valObject || { editType : 'calc' } ;
19811981
1982- if ( propStr === '' ) {
1982+ if ( i !== '' && propStr === '' ) {
19831983 // 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
19851986 if ( manageArrays . isAddVal ( vi ) ) {
19861987 undoit [ ai ] = null ;
19871988 } else if ( manageArrays . isRemoveVal ( vi ) ) {
@@ -1990,7 +1991,6 @@ function _relayout(gd, aobj) {
19901991 Lib . warn ( 'unrecognized full object value' , aobj ) ;
19911992 }
19921993 }
1993-
19941994 editTypes . update ( flags , updateValObject ) ;
19951995
19961996 // 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() {
367367 } ) ;
368368
369369 it ( 'can replace the shapes array' , function ( done ) {
370+ spyOn ( Lib , 'warn' ) ;
371+
370372 Plotly . relayout ( gd , { shapes : [
371373 getRandomShape ( ) ,
372374 getRandomShape ( )
@@ -375,6 +377,7 @@ describe('Test shapes:', function() {
375377 expect ( countShapePathsInLowerLayer ( ) ) . toEqual ( 0 ) ;
376378 expect ( countShapePathsInSubplots ( ) ) . toEqual ( 0 ) ;
377379 expect ( gd . layout . shapes . length ) . toBe ( 2 ) ;
380+ expect ( Lib . warn ) . not . toHaveBeenCalled ( ) ;
378381 } )
379382 . catch ( failTest )
380383 . then ( done ) ;
You can’t perform that action at this time.
0 commit comments