File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -3,17 +3,15 @@ import React from 'react';
3
3
import { PanelModelInstance } from '~/dashboard-editor/model/panels' ;
4
4
import { PanelRenderModelInstance } from '~/model' ;
5
5
6
- type PanelContextType < T = PanelModelInstance | PanelRenderModelInstance | null > = {
7
- panel : T ;
6
+ const PanelContext = React . createContext < {
7
+ panel : PanelModelInstance | PanelRenderModelInstance | null ;
8
8
data : TPanelData ;
9
9
loading : boolean ;
10
10
errors : string [ ] ;
11
11
downloadPanelScreenshot : ( ) => void ;
12
12
echartsOptions : EChartsOption | null ;
13
13
setEchartsOptions : ( v : EChartsOption | null ) => void ;
14
- } ;
15
-
16
- const PanelContext = React . createContext < PanelContextType < null > > ( {
14
+ } > ( {
17
15
panel : null ,
18
16
data : { } ,
19
17
loading : false ,
@@ -30,7 +28,15 @@ function usePanelContext<T = PanelRenderModelInstance>() {
30
28
if ( ! c . panel ) {
31
29
throw new Error ( 'Please use PanelContextProvider' ) ;
32
30
}
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
+ } ;
34
40
}
35
41
36
42
export const useRenderPanelContext = ( ) => usePanelContext < PanelRenderModelInstance > ( ) ;
You can’t perform that action at this time.
0 commit comments