Skip to content

Commit 5cc757c

Browse files
committed
merging this into dev branch
2 parents 09c4836 + 945f4ca commit 5cc757c

File tree

280 files changed

+2249
-134337
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

280 files changed

+2249
-134337
lines changed

README.fr.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
</a>
1919
<a href="https://travis-ci.com/oslabs-beta/reactime">
2020
<img src="https://travis-ci.com/oslabs-beta/reactime.svg?branch=master" alt="Build Status">
21-
</a>
21+
</a>
2222
<a href="http://badge.fury.io/js/reactime">
2323
<img src="https://badge.fury.io/js/reactime.svg" alt="npm version">
24-
</a>
24+
</a>
2525
<img src="https://img.shields.io/badge/babel%20preset-airbnb-ff69b4" alt="BabelPresetPrefs">
2626
<img src="https://img.shields.io/badge/linted%20with-eslint-blueviolet" alt="LintPrefs">
2727
</p>
@@ -40,7 +40,7 @@
4040
</p>
4141

4242
<p align="center">
43-
  <a href="#how-to-use">Manuel</a> • <a href="#features">Caractéristiques</a> • <a href="https://reactime.io">Website</a> • <a href="#readmore">En savoir plus</a>
43+
  <a href="#how-to-use">Manuel</a> • <a href="#features">Caractéristiques</a> • <a href="https://reactime.dev">Website</a> • <a href="#readmore">En savoir plus</a>
4444
</p>
4545

4646
Actuellement, Reactime est compatible avec les applications React qui utilisent des composants à état (stateful) et Hooks, avec un support en version bêta de Recoil et de pour le Context API.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
</p>
4141

4242
<p align="center">
43-
<a href="#how-to-use">How To Use</a> • <a href="#features">Features</a> • <a href="https://reactime.io">Website</a> • <a href="#read-more">Read More</a>
43+
<a href="#how-to-use">How To Use</a> • <a href="#features">Features</a> • <a href="https://reactime.dev">Website</a> • <a href="#read-more">Read More</a>
4444
</p>
4545

4646
<b>Reactime 16.0</b> presents the codebase with substantial, much-needed

demo-app/src/client/Router.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ ReactDOM.render(
1515
<Context.Provider value={{ bullshit: 'bullshit' }}>
1616
<Nav />
1717
<Routes>
18-
<Route path="/tictactoe" element={<Board />}/>
19-
<Route path="/" element={<Home />}/>
20-
<Route path="/buttons" element={<Buttons />}/>
18+
<Route path="/tictactoe" element={<Board />}/>
19+
<Route path="/" element={<Home />}/>
20+
<Route path="/buttons" element={<Buttons />}/>
2121
</Routes>
2222
</Context.Provider>
2323
</BrowserRouter>, root);

src/app/components/StateRoute/ComponentMap/ComponentMap.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,19 @@ export default function ComponentMap({
153153
return propsFormat;
154154
};
155155

156+
const formatContext = data => {
157+
const propsFormat = [];
158+
const nestedObj = [];
159+
for (const key in data) {
160+
propsFormat.push(
161+
<p className="stateprops">
162+
{`${key}: ${data[key]}`}
163+
</p>,
164+
);
165+
}
166+
return propsFormat;
167+
};
168+
156169
const formatState = state => {
157170
if (state === 'stateless') return ['stateless'];
158171
return ['stateful'];
@@ -378,10 +391,15 @@ export default function ComponentMap({
378391
{formatState(tooltipData.state)}
379392
</div>
380393
<div style={React.scrollStyle}>
381-
<div className="props">
382-
Props:
394+
<div className="tooltipWrapper">
395+
<h2>Props:</h2>
383396
{formatProps(tooltipData.componentData.props)}
384397
</div>
398+
{tooltipData.componentData.context &&
399+
<div className="tooltipWrapper">
400+
<h2>Context:</h2>
401+
{formatContext(tooltipData.componentData.context)}
402+
</div>}
385403
</div>
386404
</div>
387405
</TooltipInPortal>

src/app/containers/ErrorContainer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ function ErrorContainer(): any {
8484
</div>
8585
<br />
8686
<a
87-
href="https://reactime.io/"
87+
href="https://reactime.dev/"
8888
target="_blank"
8989
rel="noopener noreferrer"
9090
>
91-
Please visit reactime.io to more info.
91+
Please visit reactime.dev to more info.
9292
</a>
9393
</div>
9494
);

src/app/styles/main.scss

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,33 @@
11
@charset 'UTF-8';
22
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');
3+
34
* {
45
font-family: 'Roboto', sans-serif;
56
}
67

8+
.tooltipWrapper {
9+
background-color: #505050;
10+
color: rgb(216, 216, 216);
11+
margin-top: 3px;
12+
margin-bottom: 3px;
13+
padding: 2px;
14+
}
15+
16+
.tooltipWrapper h2 {
17+
margin-top: 1px;
18+
margin-bottom: 1px;
19+
margin-left: 1px;
20+
font-size: small;
21+
font-weight: bolder;
22+
}
23+
24+
.tooltipWrapper p {
25+
margin-top: 1px;
26+
margin-bottom: 1px;
27+
margin-left: 10px;
28+
margin-right: 3px;
29+
}
30+
731
/* width */
832
::-webkit-scrollbar {
933
width: 5px;
@@ -36,13 +60,13 @@
3660

3761
// 4. Layout-related sections
3862
@import 'layout/mainContainer', 'layout/bodyContainer', 'layout/actionContainer',
39-
'layout/errorContainer', 'layout/stateContainer', 'layout/travelContainer',
40-
'layout/buttonsContainer', 'layout/headContainer.scss';
63+
'layout/errorContainer', 'layout/stateContainer', 'layout/travelContainer',
64+
'layout/buttonsContainer', 'layout/headContainer.scss';
4165

4266
// 5. Components
4367
@import 'components/buttons', 'components/actionComponent',
44-
'components/jsonTree', 'components/renderingFrequency',
45-
'components/performanceVisx';
68+
'components/jsonTree', 'components/renderingFrequency',
69+
'components/performanceVisx';
4670

4771
// slider component
4872
@import './components/rc-slider', './components/sliderHandle';
@@ -51,4 +75,4 @@
5175
@import './components/d3graph.css';
5276

5377
// diff component
54-
@import './components/diff';
78+
@import './components/diff';

src/backend/__tests__/tree.test.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import Tree from '../tree';
2-
import { networkInterfaces } from 'os';
3-
4-
5-
62

73
describe('Tree unit test', () => {
84
const newTree = new Tree({});
@@ -73,32 +69,30 @@ describe('Tree unit test', () => {
7369

7470
it('the tree now has 2 children', () => {
7571
expect(newTree.children.length).toBe(2);
76-
})
72+
});
7773

7874
it('both of the children has the parent as this tree', () => {
7975
expect(newTree.children[0]).toEqual(returnChild);
8076
expect(newTree.children[1]).toEqual(returnSibling);
81-
})
77+
});
8278

8379
it('both of the children has the parent as this tree', () => {
8480
expect(returnChild.parent).toEqual(newTree);
8581
expect(returnSibling.parent).toEqual(newTree);
86-
})
87-
})
88-
89-
82+
});
83+
});
9084

91-
// review this test
85+
// review this test
9286
// returnSibling not used?
9387
// Check Test
9488

9589
describe('Copy & clean tree', () => {
9690
// const newTree = new Tree({});
9791
const returnChild = newTree.addChild('stateful', 'child', {}, null);
98-
const returnSibling = returnChild.addSibling('stateful', 'child', {}, null);
92+
returnChild.addSibling('stateful', 'child', {}, null);
9993
const copy = newTree.cleanTreeCopy();
10094
it('its copy has 2 children', () => {
10195
expect(copy.children.length).toEqual(2);
102-
})
103-
})
104-
})
96+
});
97+
});
98+
});

src/backend/linkFiber.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,29 @@ function createTree(
181181
actualStartTime,
182182
selfBaseDuration,
183183
treeBaseDuration,
184+
dependencies,
185+
_debugHookTypes,
184186
} = currentFiber;
185187

188+
// if (currentFiber.tag === 10) {
189+
// const queue = [currentFiber];
190+
// while (queue.length > 0) {
191+
// const tempFiber = queue.shift();
192+
// if (tempFiber.tag === 0) console.log(tempFiber);
193+
// if (tempFiber.sibling) {
194+
// queue.push(tempFiber.sibling);
195+
// }
196+
// if (tempFiber.child) {
197+
// queue.push(tempFiber.child);
198+
// }
199+
// }
200+
// }
201+
186202
// check to see if we can get the information we were looking for
187203
// need to figure out what tag is
188204
if (tag === 5) {
189205
try {
190-
if (memoizedProps.children[0]._owner?.memoizedProps !== undefined) {
206+
if (memoizedProps.children && memoizedProps.children[0]?._owner?.memoizedProps !== undefined) {
191207
const propsData = memoizedProps.children[0]._owner.memoizedProps;
192208
const newPropData = convertDataToString(propsData, tree.componentData.props ? tree.componentData.props : null);
193209
tree.componentData = {
@@ -210,6 +226,7 @@ function createTree(
210226
selfBaseDuration?: number;
211227
treeBaseDuration?: number;
212228
props?: any,
229+
context?: any,
213230
} = {};
214231
let componentFound = false;
215232

@@ -218,6 +235,10 @@ function createTree(
218235
componentData.props = convertDataToString(memoizedProps, null);
219236
}
220237

238+
// if the component uses the useContext hook, we want to grab the co text object and add it to the componentData object for that fiber
239+
if (tag === 0 && _debugHookTypes) {
240+
componentData.context = convertDataToString(dependencies?.firstContext?.memoizedValue, null);
241+
}
221242
// Check if node is a stateful class component
222243
if (stateNode && stateNode.state && (tag === 0 || tag === 1 || tag === 2)) {
223244
// Save component's state and setState() function to our record for future
@@ -245,6 +266,7 @@ function createTree(
245266
const hooksStates = traverseHooks(memoizedState);
246267
const hooksNames = getHooksNames(elementType.toString());
247268

269+
248270
hooksStates.forEach((state, i) => {
249271
hooksIndex = componentActionsRecord.saveNew(
250272
state.state,

src/backend/types/backendTypes.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,8 @@ export type Fiber = {
174174
// This value bubbles up during the "complete" phase.
175175
// This field is only set when the enableProfilerTimer flag is enabled.
176176
treeBaseDuration?: number;
177+
178+
dependencies: any;
179+
180+
_debugHookTypes: any;
177181
};

tests/README.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)