Skip to content

Commit d2b6183

Browse files
committed
fix(dashboard): panel-context is not included in dist
1 parent 6671d60 commit d2b6183

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

dashboard/src/contexts/panel-context.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@ import React from 'react';
33
import { PanelModelInstance } from '~/dashboard-editor/model/panels';
44
import { PanelRenderModelInstance } from '~/model';
55

6-
type PanelContextType<T = PanelModelInstance | PanelRenderModelInstance | null> = {
7-
panel: T;
6+
const PanelContext = React.createContext<{
7+
panel: PanelModelInstance | PanelRenderModelInstance | null;
88
data: TPanelData;
99
loading: boolean;
1010
errors: string[];
1111
downloadPanelScreenshot: () => void;
1212
echartsOptions: EChartsOption | null;
1313
setEchartsOptions: (v: EChartsOption | null) => void;
14-
};
15-
16-
const PanelContext = React.createContext<PanelContextType<null>>({
14+
}>({
1715
panel: null,
1816
data: {},
1917
loading: false,
@@ -30,7 +28,15 @@ function usePanelContext<T = PanelRenderModelInstance>() {
3028
if (!c.panel) {
3129
throw new Error('Please use PanelContextProvider');
3230
}
33-
return c as PanelContextType<T>;
31+
return c as {
32+
panel: T;
33+
data: TPanelData;
34+
loading: boolean;
35+
errors: string[];
36+
downloadPanelScreenshot: () => {};
37+
echartsOptions: null;
38+
setEchartsOptions: (v: EChartsOption | null) => {};
39+
};
3440
}
3541

3642
export const useRenderPanelContext = () => usePanelContext<PanelRenderModelInstance>();

0 commit comments

Comments
 (0)