@@ -2592,7 +2592,7 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) {
25922592 * - traces {array} trace indices
25932593 * - baseframe {string} name of frame from which this frame gets defaults
25942594 *
2595- * @param {array of integers) indices
2595+ * @param {array of integers } indices
25962596 * an array of integer indices matching the respective frames in `frameList`. If not
25972597 * provided, an index will be provided in serial order. If already used, the frame
25982598 * will be overwritten.
@@ -2601,6 +2601,7 @@ Plotly.addFrames = function(gd, frameList, indices) {
26012601 gd = Lib . getGraphDiv ( gd ) ;
26022602
26032603 var numericNameWarningCount = 0 ;
2604+ var numericNameWarningCountLimit = 5 ;
26042605
26052606 if ( frameList === null || frameList === undefined ) {
26062607 return Promise . resolve ( ) ;
@@ -2616,7 +2617,7 @@ Plotly.addFrames = function(gd, frameList, indices) {
26162617
26172618 var i , frame , j , idx ;
26182619 var _frames = gd . _transitionData . _frames ;
2619- var _hash = gd . _transitionData . _frameHash ;
2620+ var _frameHash = gd . _transitionData . _frameHash ;
26202621
26212622
26222623 if ( ! Array . isArray ( frameList ) ) {
@@ -2634,20 +2635,20 @@ Plotly.addFrames = function(gd, frameList, indices) {
26342635 for ( i = frameList . length - 1 ; i >= 0 ; i -- ) {
26352636 if ( ! Lib . isPlainObject ( frameList [ i ] ) ) continue ;
26362637
2637- var name = ( _hash [ frameList [ i ] . name ] || { } ) . name ;
2638+ var name = ( _frameHash [ frameList [ i ] . name ] || { } ) . name ;
26382639 var newName = frameList [ i ] . name ;
26392640
2640- if ( name && newName && typeof newName === 'number' && _hash [ name ] ) {
2641+ if ( name && newName && typeof newName === 'number' && _frameHash [ name ] && numericNameWarningCount < numericNameWarningCountLimit ) {
26412642 numericNameWarningCount ++ ;
26422643
2643- Lib . warn ( 'addFrames: overwriting frame "' + _hash [ name ] . name +
2644+ Lib . warn ( 'addFrames: overwriting frame "' + _frameHash [ name ] . name +
26442645 '" with a frame whose name of type "number" also equates to "' +
26452646 name + '". This is valid but may potentially lead to unexpected ' +
26462647 'behavior since all plotly.js frame names are stored internally ' +
26472648 'as strings.' ) ;
26482649
2649- if ( numericNameWarningCount > 5 ) {
2650- Lib . warn ( 'addFrames: This API call has yielded too many warnings. ' +
2650+ if ( numericNameWarningCount === numericNameWarningCountLimit ) {
2651+ Lib . warn ( 'addFrames: This API call has yielded too many of these warnings. ' +
26512652 'For the rest of this call, further warnings about numeric frame ' +
26522653 'names will be suppressed.' ) ;
26532654 }
@@ -2682,10 +2683,10 @@ Plotly.addFrames = function(gd, frameList, indices) {
26822683 if ( ! frame . name ) {
26832684 // Repeatedly assign a default name, incrementing the counter each time until
26842685 // we get a name that's not in the hashed lookup table:
2685- while ( _hash [ ( frame . name = 'frame ' + gd . _transitionData . _counter ++ ) ] ) ;
2686+ while ( _frameHash [ ( frame . name = 'frame ' + gd . _transitionData . _counter ++ ) ] ) ;
26862687 }
26872688
2688- if ( _hash [ frame . name ] ) {
2689+ if ( _frameHash [ frame . name ] ) {
26892690 // If frame is present, overwrite its definition:
26902691 for ( j = 0 ; j < _frames . length ; j ++ ) {
26912692 if ( ( _frames [ j ] || { } ) . name === frame . name ) break ;
0 commit comments