Skip to content

Commit e977e32

Browse files
committed
testing stuff
1 parent 034fa73 commit e977e32

File tree

4 files changed

+55
-29
lines changed

4 files changed

+55
-29
lines changed

src/app/components/PerformanceVisx.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ const traverse = (snapshot, data, currTotalRender = 0) => {
6161
}
6262
// increment render frequencies
6363
if (renderTime > 0) {
64+
console.log('what is the child', child);
65+
console.log('por que?', data.componentData[componentName]);
6466
data.componentData[componentName].renderFrequency++;
67+
} else {
68+
console.log('what is the child', child);
69+
console.log('we dont increment here', data.componentData[componentName], 'and the child', child);
6570
}
6671

6772
// add to total render time

src/app/containers/MainContainer.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ function MainContainer(): any {
6262
dispatch(setTab(sourceTab));
6363
// set state with the information received from the background script
6464
dispatch(addNewSnapshots(payload));
65+
console.log('this is the payload and this is the sendSnapshorts', sourceTab, payload);
6566
break;
6667
}
6768
case 'initialConnectSnapshots': {
6869
dispatch(setTab(maxTab));
6970
dispatch(initialConnect(payload));
71+
console.log('this is the initial connect and settab', maxTab, payload);
7072
break;
7173
}
7274
default:

src/backend/linkFiber.ts

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ declare global {
4040
let fiberRoot = null;
4141
let doWork = true;
4242
const circularComponentTable = new Set();
43-
let isRecoil = false;
43+
const isRecoil = false;
4444
let allAtomsRelationship = [];
4545
let initialstart = false;
4646
let rtidCounter = 0;
@@ -50,12 +50,10 @@ const recoilDomNode = {};
5050
// Simple check for whether our target app uses Recoil
5151
// can these be regular
5252

53-
5453
// if (window.$recoilDebugStates) {
5554
// isRecoil = true;
5655
// }
5756

58-
5957
// This is deprecated Recoil code. Recoil as of 01-03-2021
6058
// does not work well with Reactime. Leaving any Recoil
6159
// code in codebase to assist with Recoil implementations
@@ -254,7 +252,8 @@ function createTree(
254252
selfBaseDuration,
255253
treeBaseDuration,
256254
} = currentFiber;
257-
//new feature adds props/state into the component
255+
// new feature adds props/state into the component
256+
258257
if (tag === 5) {
259258
try {
260259
// console.log('this is the tree', tree);
@@ -438,7 +437,6 @@ function createTree(
438437
let pointer = currentFiber;
439438
// end of repeat code
440439

441-
442440
while (pointer !== null) {
443441
if (pointer.stateNode !== null) {
444442
rtid = `fromLinkFiber${rtidCounter++}`;
@@ -460,7 +458,6 @@ function createTree(
460458
pointer = pointer.child;
461459
}
462460
} else {
463-
464461
if (
465462
currentFiber.child
466463
&& currentFiber.child.stateNode
@@ -474,18 +471,28 @@ function createTree(
474471
const lastClass = currentFiber.child.stateNode.classList[
475472
currentFiber.child.stateNode.classList.length - 1
476473
];
474+
// console.log('show me the last class', currentFiber.child.stateNode.classList);
477475
if (lastClass.includes('fromLinkFiber')) {
478476
currentFiber.child.stateNode.classList.remove(lastClass);
479477
}
480478
}
481479
currentFiber.child.stateNode.classList.add(rtid);
482480
}
483481
rtidCounter++;
484-
console.log('rtidCounter', rtidCounter);
482+
// console.log('rtidCounter', rtidCounter);
483+
// console.log('checking the currentFiber', currentFiber);
485484
}
486485
// checking if tree fromSibling is true
487486
if (fromSibling) {
488487
// tree object from tree.ts, with addSibling
488+
// console.log('looking through every seingle currentFiber', currentFiber);
489+
// try {
490+
// console.log('hello hello this is next effect', currentFiber.nextEffect);
491+
// } catch (error) {
492+
// console.log('no next effect');
493+
// }
494+
// console.log('we are in addsibling and this is the rtid and element name', rtid, elementType.name, 'this is the current fiber', currentFiber);
495+
console.log('looking at this circuclar componnent table in sibling', circularComponentTable);
489496
newNode = tree.addSibling(
490497
newState,
491498
elementType ? elementType.name : 'nameless',
@@ -494,6 +501,14 @@ function createTree(
494501
recoilDomNode
495502
);
496503
} else {
504+
// console.log('looking through every seingle currentFiber', currentFiber);
505+
// try {
506+
// console.log('hello hello this is next effect', currentFiber.nextEffect);
507+
// } catch (error) {
508+
// console.log('no next effect');
509+
// }
510+
// console.log('we are in addchild and this is the rtid and element name', rtid, elementType.name, 'this is the current fiber', currentFiber);
511+
console.log('looking at this circuclar componnent table in child', circularComponentTable);
497512
newNode = tree.addChild(
498513
newState,
499514
elementType ? elementType.name : 'nameless',
@@ -503,6 +518,7 @@ function createTree(
503518
);
504519
}
505520
} else {
521+
console.log('why do we go here will the duplicate come here', tree);
506522
newNode = tree;
507523
}
508524

src/backend/tree.ts

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
/* eslint-disable no-console */
88
/* eslint-disable no-param-reassign */
99

10-
import { createGenerateClassName } from "@material-ui/styles";
10+
import { createGenerateClassName } from '@material-ui/styles';
1111

1212
let copyInstances = 0;
1313
const circularComponentTable = new Set<Tree>();
14-
let componentNames = {}
14+
let componentNames = {};
1515

1616
// Removes unserializable state data such as functions
1717
function scrubUnserializableMembers(tree: Tree): Tree {
@@ -57,39 +57,40 @@ class Tree {
5757

5858
recoilDomNode: any;
5959

60-
//Duplicate names: add a unique number ID
61-
//Create an object 'componentNames' to store each component name as a key and it's frequency of use as its value
62-
//When a new component is made on the tree, check if the new component's name already exists in 'componentNames' (possibly with the .hasOwnProperty method)
63-
//If the name already exists, add its value (an integer) to the name
64-
//Also, increment the value after
65-
//If not, create the new component and also a new key: value pair in 'componentNames' with the component's name as the key and 0 as its value
66-
//EXAMPLE OF COMPONENTNAMES OBJECT: {editableInput: 1, Provider: 0, etc}
60+
// Duplicate names: add a unique number ID
61+
// Create an object 'componentNames' to store each component name as a key and it's frequency of use as its value
62+
// When a new component is made on the tree, check if the new component's name already exists in 'componentNames' (possibly with the .hasOwnProperty method)
63+
// If the name already exists, add its value (an integer) to the name
64+
// Also, increment the value after
65+
// If not, create the new component and also a new key: value pair in 'componentNames' with the component's name as the key and 0 as its value
66+
// EXAMPLE OF COMPONENTNAMES OBJECT: {editableInput: 1, Provider: 0, etc}
6767

68-
//Empty names:
69-
//If string, rtid without 'fromLinkFiber"
70-
//If object
71-
//If null
68+
// Empty names:
69+
// If string, rtid without 'fromLinkFiber"
70+
// If object
71+
// If null
7272

73-
constructor(state: string | {}, name = 'nameless', componentData: {} = {}, rtid: any = null, recoilDomNode: any = null) {
73+
constructor(state: string | {}, name = 'nameless', componentData: {} = {}, rtid: any = null, recoilDomNode: any = null, string: any = null) {
7474
this.state = state === 'root' ? 'root' : serializeState(state);
7575
this.name = name;
7676
this.componentData = componentData ? JSON.parse(JSON.stringify(componentData)) : {};
7777
this.children = [];
7878
this.parent = null; // ref to parent so we can add siblings
7979
this.rtid = rtid;
8080
this.recoilDomNode = recoilDomNode;
81+
console.log('there should be a friggin rtid number here', rtid, 'this is what we are creating right now', this, 'location of where it came from', string);
8182
}
8283

8384
// Returns a unique name ready to be used
8485
checkForDuplicates(name: string) {
85-
//check for empty name
86-
if (name === "" && typeof this.rtid === 'string') {
86+
// check for empty name
87+
if (name === '' && typeof this.rtid === 'string') {
8788
name = this.rtid.replace('fromLinkFiber', '');
8889
}
8990
if (this.state === 'root') {
9091
componentNames = {};
9192
}
92-
//check for duplicate
93+
// check for duplicate
9394
else if (componentNames[name] !== undefined) {
9495
const count = componentNames[name] + 1;
9596
const newName = name + count;
@@ -102,21 +103,23 @@ class Tree {
102103

103104
addChild(state: string | {}, name: string, componentData: {}, rtid: any, recoilDomNode: any): Tree {
104105
const uniqueName = this.checkForDuplicates(name);
105-
console.log("ChildName:", uniqueName);
106+
// console.log('ChildName:', uniqueName);
106107
this.name = uniqueName;
107-
const newChild: Tree = new Tree(state, uniqueName, componentData, rtid, recoilDomNode);
108+
const newChild: Tree = new Tree(state, uniqueName, componentData, rtid, recoilDomNode, 'child');
108109
newChild.parent = this;
109110
this.children.push(newChild);
111+
// console.log('this is the name and rtid', uniqueName, rtid);
110112
return newChild;
111113
}
112114

113115
addSibling(state: string | {}, name: string, componentData: {}, rtid: any, recoilDomNode: any): Tree {
114116
const uniqueName = this.checkForDuplicates(name);
115-
console.log("SiblingName:", uniqueName);
117+
// console.log('SiblingName:', uniqueName);
116118
this.name = uniqueName;
117-
const newSibling: Tree = new Tree(state, uniqueName, componentData, rtid, recoilDomNode);
119+
const newSibling: Tree = new Tree(state, uniqueName, componentData, rtid, recoilDomNode, 'sibiling');
118120
newSibling.parent = this.parent;
119121
this.parent.children.push(newSibling);
122+
// console.log('this is the name and rtid', uniqueName, rtid);
120123
return newSibling;
121124
}
122125

@@ -134,7 +137,7 @@ class Tree {
134137
}
135138
// creates copy of present node
136139
let copy: Tree = new Tree(this.state, this.name, this.componentData, this.rtid, this.recoilDomNode);
137-
console.log('CLEANTREECOPY TEST', copy);
140+
// console.log('CLEANTREECOPY TEST', copy);
138141
delete copy.parent;
139142
circularComponentTable.add(this);
140143
copy = scrubUnserializableMembers(copy);

0 commit comments

Comments
 (0)