Skip to content

Commit 180a9b7

Browse files
committed
Completed first LinkedList algorithm to parse componentName and atomName relationship, still need to parse for selectors relationship
1 parent 660264d commit 180a9b7

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

src/backend/linkFiber.ts

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
import Tree from './tree';
2121
import componentActionsRecord from './masterState';
2222
import { throttle, getHooksNames } from './helpers';
23+
import { Console } from 'console';
2324

2425
// Set global variables to use in exported module and helper functions
2526
declare global {
@@ -197,33 +198,18 @@ function createTree(
197198
currentFiber.memoizedState.next.memoizedState &&
198199
currentFiber.memoizedState.next.memoizedState.deps
199200
) {
200-
let pointer = currentFiber.memoizedState.next);
201-
201+
202+
let pointer = currentFiber.memoizedState.next;
202203
while (pointer !== null){
203204
if(!Array.isArray(pointer.memoizedState)){
204-
console.log(pointer)
205+
let componentName = currentFiber.elementType.name
206+
let atomName = pointer.memoizedState.deps[0]['key']
207+
allAtomsRelationship.push([atomName, componentName,'atoms and components']);
205208
}
206209
pointer = pointer.next
207210
}
208211
}
209212

210-
// if (elementType?.name && isRecoil) {
211-
// let pointer = memoizedState;
212-
// while (pointer !== null && pointer !== undefined && pointer.next !== null) {
213-
// pointer = pointer.next;
214-
// }
215-
216-
// if (pointer?.memoizedState[1]?.[0].current) {
217-
// const atomName = pointer.memoizedState[1]?.[0].current.keys().next().value;
218-
// allAtomsRelationship.push([atomName, elementType?.name, 'atoms and components']);
219-
// }
220-
221-
// if (pointer?.memoizedState[1]?.[0].key) {
222-
// const atomName = pointer.memoizedState[1]?.[0].key;
223-
// allAtomsRelationship.push([atomName, elementType?.name, 'atoms and components']);
224-
// }
225-
// }
226-
227213
let newState: any | { hooksState?: any[] } = {};
228214
let componentData: {
229215
hooksState?: any[];

0 commit comments

Comments
 (0)