Skip to content

Commit

Permalink
fix: fix after review
Browse files Browse the repository at this point in the history
  • Loading branch information
Marginy605 committed Jan 23, 2023
1 parent a923863 commit ecb5166
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions src/plugins/indicator/renderer/IndicatorWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,16 @@ const IndicatorWidget = React.forwardRef<ChartKitWidgetRef | undefined, ChartKit
const {
onLoad,
onRender,
onChartLoad,
formatNumber,
data: {data = [], defaultColor},
} = props;

React.useLayoutEffect(() => {
// TODO: swap to onRender after https://github.com/gravity-ui/chartkit/issues/33
onLoad?.();
onRender?.(); // TODO renderTime ?
onRender?.(); // TODO renderTime
});

React.useLayoutEffect(() => {
onChartLoad?.({widget: null});
}, []);

if (isEmpty(data)) {
throw new ChartKitError({
code: CHARTKIT_ERROR_CODE.NO_DATA,
Expand Down
2 changes: 1 addition & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export type ChartKitProps<T extends ChartKitType> = {
* called on mount
* @param data
*/
onChartLoad?: (data?: ChartKitOnChartLoad) => void;
onChartLoad?: (data?: ChartKitOnChartLoad) => void | never;

onError?: ChartKitOnError;
} & {[key in keyof Omit<ChartKitWidget[T], 'data' | 'widget'>]: ChartKitWidget[T][key]};
Expand Down

0 comments on commit ecb5166

Please sign in to comment.