Skip to content

Commit 55777fb

Browse files
committed
Additional console logs
1 parent c6d38ec commit 55777fb

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

package/linkFiber.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ module.exports = (snap, mode) => {
99

1010
function sendSnapshot() {
1111
// don't send messages while jumping or while paused
12+
// DEV: So that when we are jumping to an old snapshot it wouldn't think we want to create new snapshots
1213
if (mode.jumping || mode.paused) return;
1314
const payload = snap.tree.getCopy();
15+
console.log('payload', payload);
1416
window.postMessage({
1517
action: 'recordSnap',
1618
payload,
1719
});
1820
}
1921

22+
// DEV: This is how we know when a change has happened (by injecting an event listener to every component's setState functionality). Will need to create a separate one for useState components
2023
function changeSetState(component) {
2124
// check that setState hasn't been changed yet
2225
if (component.setState.linkFiberChanged) return;
@@ -63,15 +66,19 @@ module.exports = (snap, mode) => {
6366
}
6467

6568
function updateSnapShotTree() {
69+
console.log('fiberRoot', fiberRoot);
6670
const { current } = fiberRoot;
71+
console.log('current', current);
6772
snap.tree = createTree(current);
6873
}
6974

7075
return container => {
76+
console.log('Container', container);
7177
const {
7278
_reactRootContainer: { _internalRoot },
7379
_reactRootContainer,
7480
} = container;
81+
console.log('Root container', _reactRootContainer);
7582
// only assign internal root if it actually exists
7683
fiberRoot = _internalRoot || _reactRootContainer;
7784
updateSnapShotTree();

package/tree.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class Tree {
1414
this.name = name;
1515
}
1616
this.children = [];
17+
// DEV: Added print() for debugging purposes
18+
this.print();
1719
}
1820

1921
appendChild(component) {
@@ -35,8 +37,10 @@ class Tree {
3537
}
3638

3739
// print out the tree in the console
40+
// DEV: Process may be different for useState components
3841
print() {
3942
const children = ['children: '];
43+
// DEV: What should we push instead for components using hooks (it wouldn't be state)
4044
this.children.forEach(child => {
4145
children.push(child.state || child.component.state);
4246
});

0 commit comments

Comments
 (0)