@@ -60,37 +60,17 @@ const circularComponentTable = new Set();
60
60
let allAtomsRelationship = [ ] ;
61
61
62
62
function getRecoilState ( ) : any {
63
- // get the last state snapshot
64
63
const RecoilSnapshotsLength = window [ `$recoilDebugStates` ] . length ;
65
64
const lastRecoilSnapshot = window [ `$recoilDebugStates` ] [ RecoilSnapshotsLength - 1 ] ;
66
- console . log ( lastRecoilSnapshot ) ;
67
-
68
- // get all atom - selector pairs, and save them as nodes
69
- // in the from to weight format
70
65
const nodeToNodeSubs = lastRecoilSnapshot . nodeToNodeSubscriptions ;
71
66
let nodeToNodeSubsKeys = lastRecoilSnapshot . nodeToNodeSubscriptions . keys ( ) ;
72
67
nodeToNodeSubsKeys . forEach (
73
68
node => {
74
69
nodeToNodeSubs . get ( node ) . forEach (
75
- nodeSubs => allAtomsRelationship . push ( [ node , nodeSubs , 1 ] )
70
+ nodeSubs => allAtomsRelationship . push ( [ node , nodeSubs , 'atoms and selectors' ] )
76
71
)
77
72
}
78
73
)
79
-
80
- // get all atom - component pairs, and save them as nodes
81
- // in the from to weight format
82
-
83
- // const nodeToCompSubs = lastRecoilSnapshot.nodeToComponentSubscriptions;
84
- // console.log(nodeToCompSubs);
85
- // let nodeToCompSubsKeys = lastRecoilSnapshot.nodeToComponentSubscriptions.keys();
86
- // nodeToCompSubsKeys.forEach(
87
- // node => {
88
- // console.log(node);
89
- // // nodeToCompSubsKeys.get(node).forEach(
90
- // // nodeSubs => allAtomsRelationship.push([node, nodeSubs, 2])
91
- // // )
92
- // }
93
- // )
94
74
}
95
75
96
76
@@ -186,13 +166,13 @@ export default (snap: Snapshot, mode: Mode): (() => void) => {
186
166
if ( pointer ?. memoizedState [ 1 ] ?. [ 0 ] . current ) {
187
167
let atomName = pointer . memoizedState [ 1 ] ?. [ 0 ] . current . keys ( ) . next ( ) . value ;
188
168
console . log ( 'atom' , pointer . memoizedState [ 1 ] ?. [ 0 ] . current . keys ( ) . next ( ) . value ) ;
189
- allAtomsRelationship . push ( [ atomName , elementType ?. name , 1 ] )
169
+ allAtomsRelationship . push ( [ atomName , elementType ?. name , 'atoms and components' ] )
190
170
}
191
171
192
172
if ( pointer ?. memoizedState [ 1 ] ?. [ 0 ] . key ) {
193
173
let atomName = pointer . memoizedState [ 1 ] ?. [ 0 ] . key ;
194
174
console . log ( 'atom' , pointer . memoizedState [ 1 ] ?. [ 0 ] . key ) ;
195
- allAtomsRelationship . push ( [ atomName , elementType ?. name , 1 ] )
175
+ allAtomsRelationship . push ( [ atomName , elementType ?. name , 'atoms and components' ] )
196
176
}
197
177
}
198
178
@@ -276,17 +256,6 @@ export default (snap: Snapshot, mode: Mode): (() => void) => {
276
256
state . component
277
257
) ;
278
258
componentData . hooksIndex = hooksIndex ;
279
-
280
- // if (newState && newState.hooksState) {
281
- // newState.hooksState.push({ [hooksNames[i]]: state.state });
282
- // } else if (newState) {
283
- // newState.hooksState = [{ [hooksNames[i]]: state.state }];
284
- // } else {
285
- // newState = { hooksState: [] };
286
- // newState.hooksState.push({ [hooksNames[i]]: state.state });
287
- // }
288
-
289
- //improves tree visualization but breaks jump
290
259
if ( newState && newState . hooksState ) {
291
260
newState . push ( state . state ) ;
292
261
} else if ( newState ) {
@@ -399,18 +368,7 @@ export default (snap: Snapshot, mode: Mode): (() => void) => {
399
368
}
400
369
401
370
return ( ) => {
402
- /* const container = document.getElementById('root');
403
- if (container._internalRoot) {
404
- fiberRoot = container._internalRoot;
405
- } else {
406
- const {
407
- _reactRootContainer: { _internalRoot },
408
- _reactRootContainer,
409
- } = container;
410
- // Only assign internal root if it actually exists
411
- fiberRoot = _internalRoot || _reactRootContainer;
412
- }
413
- */
371
+
414
372
const devTools = window . __REACT_DEVTOOLS_GLOBAL_HOOK__ ;
415
373
const reactInstance = devTools ? devTools . renderers . get ( 1 ) : null ;
416
374
fiberRoot = devTools . getFiberRoots ( 1 ) . values ( ) . next ( ) . value ;
0 commit comments