@@ -9,9 +9,6 @@ import React, {
99import type { Ref , MouseEvent } from 'react' ;
1010import ChartJS from 'chart.js/auto' ;
1111import type { ChartData , ChartType , DefaultDataPoint } from 'chart.js' ;
12- import merge from 'lodash/merge' ;
13- import assign from 'lodash/assign' ;
14- import find from 'lodash/find' ;
1512
1613import { Props , ChartJSOrUndefined , TypedChartComponent } from './types' ;
1714
@@ -49,7 +46,7 @@ function ChartComponent<
4946 : {
5047 datasets : [ ] ,
5148 } ;
52- } else return merge ( { } , data ) ;
49+ } else return data ;
5350 } , [ data , canvas . current ] ) ;
5451
5552 const [ chart , setChart ] = useState < TypedChartJS > ( ) ;
@@ -125,12 +122,11 @@ function ChartComponent<
125122 const { datasets : currentDataSets = [ ] } = chart . config . data ;
126123
127124 // copy values
128- assign ( chart . config . data , newChartData ) ;
125+ Object . assign ( chart . config . data , newChartData ) ;
129126
130127 chart . config . data . datasets = newDataSets . map ( ( newDataSet : any ) => {
131128 // given the new set, find it's current match
132- const currentDataSet = find (
133- currentDataSets ,
129+ const currentDataSet = currentDataSets . find (
134130 d => d . label === newDataSet . label && d . type === newDataSet . type
135131 ) ;
136132
@@ -146,10 +142,13 @@ function ChartComponent<
146142 }
147143
148144 // copy in values
149- assign ( currentDataSet . data , newDataSet . data ) ;
145+ Object . assign ( currentDataSet . data , newDataSet . data ) ;
150146
151147 // apply dataset changes, but keep copied data
152- assign ( currentDataSet , { ...newDataSet , data : currentDataSet . data } ) ;
148+ Object . assign ( currentDataSet , {
149+ ...newDataSet ,
150+ data : currentDataSet . data ,
151+ } ) ;
153152 return currentDataSet ;
154153 } ) ;
155154
0 commit comments