diff --git a/src/plugins/indicator/renderer/IndicatorWidget.tsx b/src/plugins/indicator/renderer/IndicatorWidget.tsx index 2a30d510..596ba53e 100644 --- a/src/plugins/indicator/renderer/IndicatorWidget.tsx +++ b/src/plugins/indicator/renderer/IndicatorWidget.tsx @@ -4,6 +4,7 @@ import {isEmpty} from 'lodash'; import {i18n} from '../../../i18n'; import {CHARTKIT_ERROR_CODE, ChartKitError} from '../../../libs'; import {CHARTKIT_SCROLLABLE_NODE_CLASSNAME} from '../../../constants'; +import {getChartPerformanceDuration, getRandomCKId, markChartPerformance} from '../../../utils'; import type {ChartKitWidgetRef, ChartKitProps} from '../../../types'; import {IndicatorItem} from './IndicatorItem'; @@ -19,13 +20,24 @@ const IndicatorWidget = React.forwardRef `${id}_${getRandomCKId()}`, + [data, defaultColor, id], + ); + React.useLayoutEffect(() => { - // TODO: swap to onRender after https://github.com/gravity-ui/chartkit/issues/33 - onLoad?.(); - // TODO: add onRender with renderTime Issue #114 - }); + markChartPerformance(generatedId); + }, [generatedId]); + + React.useEffect(() => { + // TODO: swap to onRender after https://github.com/yandex-cloud/chartkit/issues/33 + onLoad?.({widgetRendering: getChartPerformanceDuration(generatedId)}); + onRender?.({renderTime: getChartPerformanceDuration(generatedId)}); + }, [onLoad, onRender]); if (isEmpty(data)) { throw new ChartKitError({