Skip to content

Commit ee197eb

Browse files
Merge pull request #3 from BagelEnthusiast/sandbox
Sandbox
2 parents c292448 + fad441f commit ee197eb

File tree

5 files changed

+42
-8
lines changed

5 files changed

+42
-8
lines changed

src/app/components/Action.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,14 @@ interface ActionProps {
4141
// index and delta props were removed from Action.jsx */
4242
// viewIndex and handleonkeyDown added to props
4343
const Action = (props: ActionProps): JSX.Element => {
44+
4445
const {
4546
selected, last, index, sliderIndex, dispatch, displayName, componentName,
4647
componentData, viewIndex, handleOnkeyDown,
4748
} = props;
4849

50+
// nathan test for props
51+
console.log('componentName: ', componentName);
4952
/**
5053
* @function cleanTime: Displays render times for state changes
5154
* @returns render display time in seconds in miliseconds
@@ -91,7 +94,8 @@ const Action = (props: ActionProps): JSX.Element => {
9194
tabIndex={index}
9295
>
9396
<div className="action-component-text">
94-
{`${displayName}: ${componentName !== 'nameless' ? componentName : ''} `}
97+
{/* {`${displayName}: ${componentName !== 'nameless' ? componentName : ''} `} */}
98+
{`displayName: ${displayName}`}
9599
</div>
96100
<button
97101
className="time-button"

src/app/components/Diff.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ function Diff(props: DiffProps) {
6161
// diff function returns a comparison of two objects, one has an updated change
6262
// just displays stateful data
6363
const delta = diff(previousDisplay, snapshot);
64+
// nathan test
65+
console.log('delta', delta);
6466
// returns html in string
6567
// just displays stateful data
6668
const html = formatters.html.format(delta, previousDisplay);

src/app/containers/ActionContainer.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ function ActionContainer(props) {
2020
let actionsArr = [];
2121
const hierarchyArr: any[] = [];
2222

23+
24+
2325
// function to traverse state from hiararchy and also getting information on display name and component name
2426
const displayArray = (obj: {
2527
stateSnapshot: { children: any[] };
@@ -38,7 +40,9 @@ function ActionContainer(props) {
3840
index: obj.index,
3941
displayName: `${obj.name}.${obj.branch}`,
4042
state: obj.stateSnapshot.children[0].state,
41-
componentName: obj.stateSnapshot.children[0].name,
43+
// componentName: obj.stateSnapshot.children[0].name,
44+
// nathan testing new entries for component name, original above
45+
componentName: obj.stateSnapshot,
4246
componentData:
4347
JSON.stringify(obj.stateSnapshot.children[0].componentData) === '{}'
4448
? ''
@@ -60,7 +64,7 @@ function ActionContainer(props) {
6064
// handles keyboard presses, function passes an event and index of each action-component
6165
function handleOnKeyDown(e: KeyboardEvent, i: number) {
6266
let currIndex = i;
63-
// up array key pressed
67+
// up arrow key pressed
6468
if (e.keyCode === 38) {
6569
currIndex -= 1;
6670
if (currIndex < 0) return;
@@ -109,14 +113,14 @@ function ActionContainer(props) {
109113
viewIndex={viewIndex}
110114
/>
111115
);
112-
}
116+
},
113117
);
114118
useEffect(() => {
115119
setActionView(true);
116120
}, []);
117121

118-
//the conditional logic below will cause ActionContainer.test.tsx to fail as it cannot find the Empty button
119-
//UNLESS actionView={true} is passed into <ActionContainer /> in the beforeEach() call in ActionContainer.test.tsx
122+
// the conditional logic below will cause ActionContainer.test.tsx to fail as it cannot find the Empty button
123+
// UNLESS actionView={true} is passed into <ActionContainer /> in the beforeEach() call in ActionContainer.test.tsx
120124
return (
121125
<div id='action-id' className='action-container'>
122126
<div id='arrow'>

src/backend/linkFiber.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ function sendSnapshot(snap: Snapshot, mode: Mode): void {
8989
if (!snap.tree) {
9090
snap.tree = new Tree('root', 'root');
9191
}
92+
// nathan test breakpoint
93+
console.log('snap: ', snap);
94+
9295
const payload = snap.tree.cleanTreeCopy();
9396
// if it's Recoil - run different actions?
9497
if (isRecoil) {
@@ -105,6 +108,7 @@ function sendSnapshot(snap: Snapshot, mode: Mode): void {
105108
// the postMessage action will be received on the content script to later update the tabsObj
106109
// this will fire off everytime there is a change in test application
107110
window.postMessage(
111+
108112
{
109113
action: 'recordSnap',
110114
payload,
@@ -218,7 +222,7 @@ function createTree(
218222
tree: Tree = new Tree('root', 'root'),
219223
fromSibling = false
220224
) {
221-
console.log('currentFiber: ', currentFiber);
225+
222226
// Base case: child or sibling pointed to null
223227
if (!currentFiber) return null;
224228
if (!tree) return tree;
@@ -239,6 +243,9 @@ function createTree(
239243
treeBaseDuration,
240244
} = currentFiber;
241245

246+
// console.log('currentFiber: ', currentFiber);
247+
// console.log('tag', tag);
248+
242249
//Checks Recoil Atom and Selector Relationships
243250
if (
244251
currentFiber.memoizedState &&
@@ -498,9 +505,16 @@ export default (snap: Snapshot, mode: Mode): (() => void) => {
498505
console.log("exporting LinkFiber!")
499506
// react devtools global hook is a global object that was injected by the React Devtools content script, allows access to fiber nodes and react version
500507
const devTools = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
508+
// nathan test
509+
console.log('devTools', devTools);
501510
const reactInstance = devTools ? devTools.renderers.get(1) : null;
511+
// nathan test
512+
console.log('reactInstance', reactInstance);
502513
fiberRoot = devTools.getFiberRoots(1).values().next().value;
503-
514+
// nathan test
515+
console.log('devTools.getFiberRoots(1)', devTools.getFiberRoots(1));
516+
console.log('devTools.getFiberRoots(1).values()', devTools.getFiberRoots(1).values());
517+
console.log('fiberRoot: ', fiberRoot);
504518
const throttledUpdateSnapshot = throttle(
505519
() => updateSnapShotTree(snap, mode),
506520
70
@@ -510,6 +524,8 @@ export default (snap: Snapshot, mode: Mode): (() => void) => {
510524
if (reactInstance && reactInstance.version) {
511525
devTools.onCommitFiberRoot = (function (original) {
512526
return function (...args) {
527+
// nathan test
528+
console.log('args', args);
513529
// eslint-disable-next-line prefer-destructuring
514530
fiberRoot = args[1];
515531
if (doWork) {

src/extension/background.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ chrome.runtime.onConnect.addListener((port) => {
131131
port.onMessage.addListener((msg) => {
132132
// msg is action denoting a time jump in devtools
133133

134+
// nathan tests below
135+
console.log('msg: ', msg);
134136
// ---------------------------------------------------------------
135137
// message incoming from devTools should look like this:
136138
// {
@@ -191,8 +193,13 @@ chrome.runtime.onConnect.addListener((port) => {
191193
});
192194
});
193195

196+
// nathan test
197+
console.log('top level log in background.js');
194198
// background.js listening for a message from contentScript.js
195199
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
200+
// nathan test
201+
console.log('request: ', request);
202+
console.log('sender: ', sender);
196203
// IGNORE THE AUTOMATIC MESSAGE SENT BY CHROME WHEN CONTENT SCRIPT IS FIRST LOADED
197204
if (request.type === 'SIGN_CONNECT') {
198205
return true;
@@ -433,6 +440,7 @@ chrome.runtime.onInstalled.addListener(() => {
433440
// when context menu is clicked, listen for the menuItemId,
434441
// if user clicked on reactime, open the devtools window
435442
chrome.contextMenus.onClicked.addListener(({ menuItemId }) => {
443+
console.log('this is the menuItemId: ', menuItemId);
436444
const options = {
437445
type: 'panel',
438446
left: 0,

0 commit comments

Comments
 (0)