@@ -60,37 +60,17 @@ const circularComponentTable = new Set();
6060let allAtomsRelationship = [ ] ;
6161
6262function getRecoilState ( ) : any {
63- // get the last state snapshot
6463 const RecoilSnapshotsLength = window [ `$recoilDebugStates` ] . length ;
6564 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
7065 const nodeToNodeSubs = lastRecoilSnapshot . nodeToNodeSubscriptions ;
7166 let nodeToNodeSubsKeys = lastRecoilSnapshot . nodeToNodeSubscriptions . keys ( ) ;
7267 nodeToNodeSubsKeys . forEach (
7368 node => {
7469 nodeToNodeSubs . get ( node ) . forEach (
75- nodeSubs => allAtomsRelationship . push ( [ node , nodeSubs , 1 ] )
70+ nodeSubs => allAtomsRelationship . push ( [ node , nodeSubs , 'atoms and selectors' ] )
7671 )
7772 }
7873 )
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- // )
9474}
9575
9676
@@ -186,13 +166,13 @@ export default (snap: Snapshot, mode: Mode): (() => void) => {
186166 if ( pointer ?. memoizedState [ 1 ] ?. [ 0 ] . current ) {
187167 let atomName = pointer . memoizedState [ 1 ] ?. [ 0 ] . current . keys ( ) . next ( ) . value ;
188168 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' ] )
190170 }
191171
192172 if ( pointer ?. memoizedState [ 1 ] ?. [ 0 ] . key ) {
193173 let atomName = pointer . memoizedState [ 1 ] ?. [ 0 ] . key ;
194174 console . log ( 'atom' , pointer . memoizedState [ 1 ] ?. [ 0 ] . key ) ;
195- allAtomsRelationship . push ( [ atomName , elementType ?. name , 1 ] )
175+ allAtomsRelationship . push ( [ atomName , elementType ?. name , 'atoms and components' ] )
196176 }
197177 }
198178
@@ -276,17 +256,6 @@ export default (snap: Snapshot, mode: Mode): (() => void) => {
276256 state . component
277257 ) ;
278258 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
290259 if ( newState && newState . hooksState ) {
291260 newState . push ( state . state ) ;
292261 } else if ( newState ) {
@@ -399,18 +368,7 @@ export default (snap: Snapshot, mode: Mode): (() => void) => {
399368 }
400369
401370 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+
414372 const devTools = window . __REACT_DEVTOOLS_GLOBAL_HOOK__ ;
415373 const reactInstance = devTools ? devTools . renderers . get ( 1 ) : null ;
416374 fiberRoot = devTools . getFiberRoots ( 1 ) . values ( ) . next ( ) . value ;
0 commit comments