@@ -14,6 +14,8 @@ import {
14
14
import Tree from './Tree' ;
15
15
import ComponentMap from './ComponentMap' ;
16
16
import PerfView from './PerfView' ;
17
+ import AtomsRelationship from './AtomsRelationship'
18
+
17
19
18
20
const History = require ( './History' ) . default ;
19
21
@@ -37,6 +39,7 @@ interface StateRouteProps {
37
39
38
40
const StateRoute = ( props : StateRouteProps ) => {
39
41
const { snapshot, hierarchy, snapshots, viewIndex } = props ;
42
+ let isRecoil = snapshot . children [ 0 ] . name === 'RecoilRoot' ;
40
43
const [ noRenderData , setNoRenderData ] = useState ( false ) ;
41
44
const [ { x, y, k } , setZoomState ] : any = useState ( {
42
45
x : 150 ,
@@ -52,6 +55,7 @@ const StateRoute = (props: StateRouteProps) => {
52
55
return < div className = "noState" > { NO_STATE_MSG } </ div > ;
53
56
} ;
54
57
58
+
55
59
// the hierarchy gets set on the first click in the page
56
60
// when the page is refreshed we may not have a hierarchy, so we need to check if hierarchy was initialized
57
61
// if true involk render chart with hierarchy
@@ -62,6 +66,13 @@ const StateRoute = (props: StateRouteProps) => {
62
66
return < div className = "noState" > { NO_STATE_MSG } </ div > ;
63
67
} ;
64
68
69
+ const renderAtomsRelationship = ( ) => {
70
+ if ( hierarchy ) {
71
+ return < AtomsRelationship hierarchy = { hierarchy } /> ;
72
+ }
73
+ return < div className = "noState" > { NO_STATE_MSG } </ div > ;
74
+ } ;
75
+
65
76
// the hierarchy gets set on the first click in the page
66
77
// when the page is refreshed we may not have a hierarchy, so we need to check if hierarchy was initialized
67
78
// if true involk render Tree with snapshot
@@ -129,7 +140,7 @@ const StateRoute = (props: StateRouteProps) => {
129
140
</ div >
130
141
< Switch >
131
142
< Route path = "/map" render = { renderComponentMap } />
132
- < Route path = "/history" render = { renderHistory } />
143
+ < Route path = "/history" render = { isRecoil ? renderAtomsRelationship : renderHistory } />
133
144
< Route path = "/performance" render = { renderPerfView } />
134
145
< Route path = "/" render = { renderTree } />
135
146
</ Switch >
0 commit comments