Skip to content

Commit af1f7a0

Browse files
Samuel  TranSamuel  Tran
authored andcommitted
Scrubbed linkfiber.ts of isRecoil and any recoil functionality
1 parent 7464830 commit af1f7a0

File tree

2 files changed

+0
-125
lines changed

2 files changed

+0
-125
lines changed

src/app/components/StateRoute.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,6 @@ const StateRoute = (props: StateRouteProps) => {
213213
<NavLink className="router-link tree-tab" activeClassName="is-active" to="/tree">
214214
Tree
215215
</NavLink>
216-
{isRecoil && (
217-
<NavLink
218-
className="router-link"
219-
activeClassName="is-active"
220-
to="/relationship"
221-
>
222-
AtomsRecoil
223-
</NavLink>
224-
)}
225216
</div>
226217
<Switch>
227218
<Route path="/performance" render={renderPerfView} />

src/backend/linkFiber.ts

Lines changed: 0 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ declare global {
4343
let fiberRoot = null;
4444
let doWork = true;
4545
const circularComponentTable = new Set();
46-
const isRecoil = false;
4746
let initialstart = false;
4847
let rtidCounter = 0;
4948
let rtid = null;
@@ -66,13 +65,6 @@ function sendSnapshot(snap: Snapshot, mode: Mode): void {
6665
}
6766
const payload = snap.tree.cleanTreeCopy();
6867
payload.route = routes.addRoute(window.location.href);
69-
// if it's Recoil - run different actions
70-
if (isRecoil) {
71-
// getRecoilState()
72-
payload.atomsComponents = atomsComponents;
73-
payload.atomSelectors = atomsSelectors;
74-
payload.recoilDomNode = recoilDomNode;
75-
}
7668
// method safely enables cross-origin communication between Window objects;
7769
// e.g., between a page and a pop-up that it spawned, or between a page
7870
// and an iframe embedded within it.
@@ -258,53 +250,6 @@ function createTree(
258250
}
259251
}
260252

261-
// Checks Recoil Atom and Selector Relationships
262-
if (
263-
currentFiber.memoizedState
264-
&& currentFiber.memoizedState.next
265-
&& currentFiber.memoizedState.next.memoizedState
266-
&& currentFiber.memoizedState.next.memoizedState.deps
267-
&& isRecoil
268-
&& currentFiber.tag === 0
269-
&& currentFiber.key === null
270-
// prevents capturing the same Fiber nodes but different key values that result from being changed
271-
) {
272-
let pointer = currentFiber.memoizedState.next;
273-
const componentName = currentFiber.elementType.name;
274-
275-
if (!atomsComponents[componentName]) {
276-
atomsComponents[componentName] = [];
277-
while (pointer !== null) {
278-
if (!Array.isArray(pointer.memoizedState)) {
279-
const atomName = pointer.memoizedState.deps[0].key;
280-
atomsComponents[componentName].push(atomName);
281-
}
282-
pointer = pointer.next;
283-
}
284-
}
285-
286-
if (
287-
currentFiber.memoizedState.next.memoizedState.deps[1].current
288-
&& !initialstart
289-
) {
290-
const getState = currentFiber.memoizedState.next.memoizedState.deps[1].current.getState()
291-
.graphsByVersion;
292-
getState.entries().forEach(value => {
293-
value[1].nodeDeps.entries().forEach(obj => {
294-
if (!atomsSelectors[obj[0]]) {
295-
atomsSelectors[obj[0]] = [];
296-
}
297-
obj[1].values().forEach(selector => {
298-
if (!atomsSelectors[obj[0]].includes(selector)) {
299-
atomsSelectors[obj[0]].push(selector);
300-
}
301-
});
302-
});
303-
});
304-
initialstart = true;
305-
}
306-
}
307-
308253
let newState: any | { hooksState?: any[] } = {};
309254
let componentData: {
310255
hooksState?: any[];
@@ -338,40 +283,11 @@ function createTree(
338283
const atomArray = [];
339284
atomArray.push(memoizedProps);
340285

341-
// RECOIL HOOKS
342-
// if (
343-
// memoizedState
344-
// && (tag === 0 || tag === 1 || tag === 2 || tag === 10)
345-
// ) {
346-
// if (memoizedState.queue) {
347-
// // Hooks states are stored as a linked list using memoizedState.next,
348-
// // so we must traverse through the list and get the states.
349-
// // We then store them along with the corresponding memoizedState.queue,
350-
// // which includes the dispatch() function we use to change their state.
351-
// const hooksStates = traverseRecoilHooks(memoizedState, memoizedProps);
352-
// hooksStates.forEach((state, i) => {
353-
// hooksIndex = componentActionsRecord.saveNew(
354-
// state.state,
355-
// state.component
356-
// );
357-
// componentData.hooksIndex = hooksIndex;
358-
// if (!newState) {
359-
// newState = { hooksState: [] };
360-
// } else if (!newState.hooksState) {
361-
// newState.hooksState = [];
362-
// }
363-
// newState.hooksState.push({ [i]: state.state });
364-
// componentFound = true;
365-
// });
366-
// }
367-
// }
368-
369286
// Check if node is a hooks useState function
370287
// REGULAR REACT HOOKS
371288
if (
372289
memoizedState
373290
&& (tag === 0 || tag === 1 || tag === 2 || tag === 10)
374-
&& isRecoil === false
375291
) {
376292
if (memoizedState.queue) {
377293
// Hooks states are stored as a linked list using memoizedState.next,
@@ -417,37 +333,6 @@ function createTree(
417333
// We want to add this fiber node to the snapshot
418334
// eslint-disable-next-line no-mixed-operators
419335
if (componentFound || newState === 'stateless' && !newState.hooksState) {
420-
if (isRecoil) {
421-
// do this down below too
422-
if (currentFiber.elementType.name) {
423-
if (!recoilDomNode[currentFiber.elementType.name]) {
424-
recoilDomNode[currentFiber.elementType.name] = [];
425-
}
426-
}
427-
let pointer = currentFiber;
428-
// end of repeat code
429-
430-
while (pointer !== null) {
431-
if (pointer.stateNode !== null) {
432-
rtid = `fromLinkFiber${rtidCounter += 1}`;
433-
// rtid = rtidCounter++;
434-
recoilDomNode[currentFiber.elementType.name].push(rtid);
435-
// check if rtid is already present
436-
// remove existing rtid before adding a new one
437-
if (pointer.stateNode.classList.length > 0) {
438-
const lastClass = pointer.stateNode.classList[
439-
pointer.stateNode.classList.length - 1
440-
];
441-
if (lastClass.includes('fromLinkFiber')) {
442-
pointer.stateNode.classList.remove(lastClass);
443-
}
444-
}
445-
446-
pointer.stateNode.classList.add(rtid);
447-
}
448-
pointer = pointer.child;
449-
}
450-
} else {
451336
if (
452337
currentFiber.child
453338
&& currentFiber.child.stateNode
@@ -468,7 +353,6 @@ function createTree(
468353
currentFiber.child.stateNode.classList.add(rtid);
469354
}
470355
rtidCounter += 1;
471-
}
472356
// checking if tree fromSibling is true
473357
if (fromSibling) {
474358
newNode = tree.addSibling(

0 commit comments

Comments
 (0)