@@ -38,6 +38,8 @@ export default class ApexCharts {
38
38
const initCtx = new InitCtxVariables ( this )
39
39
initCtx . initModules ( )
40
40
41
+ this . lastUpdateOptions = null
42
+
41
43
this . create = Utils . bind ( this . create , this )
42
44
this . windowResizeHandler = this . _windowResizeHandler . bind ( this )
43
45
this . parentResizeHandler = this . _parentResizeCallback . bind ( this )
@@ -429,6 +431,16 @@ export default class ApexCharts {
429
431
// fixes apexcharts.js#1488
430
432
w . globals . selection = undefined
431
433
434
+ if (
435
+ this . lastUpdateOptions &&
436
+ JSON . stringify ( this . lastUpdateOptions ) === JSON . stringify ( options )
437
+ ) {
438
+ // Options are identical, skip the update
439
+ return resolve ( this )
440
+ }
441
+
442
+ this . lastUpdateOptions = Utils . clone ( options )
443
+
432
444
if ( options . series ) {
433
445
this . series . resetSeries ( false , true , false )
434
446
if ( options . series . length && options . series [ 0 ] . data ) {
@@ -527,6 +539,16 @@ export default class ApexCharts {
527
539
528
540
update ( options ) {
529
541
return new Promise ( ( resolve , reject ) => {
542
+ if (
543
+ this . lastUpdateOptions &&
544
+ JSON . stringify ( this . lastUpdateOptions ) === JSON . stringify ( options )
545
+ ) {
546
+ // Options are identical, skip the update
547
+ return resolve ( this )
548
+ }
549
+
550
+ this . lastUpdateOptions = Utils . clone ( options )
551
+
530
552
new Destroy ( this . ctx ) . clear ( { isUpdating : true } )
531
553
532
554
const graphData = this . create ( this . w . config . series , options )
0 commit comments