Skip to content

Commit a75a47c

Browse files
committed
debuged diff and sync performance data
1 parent e544ca8 commit a75a47c

File tree

6 files changed

+42
-10
lines changed

6 files changed

+42
-10
lines changed

src/app/components/Action.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,11 @@ const Action = props => {
2323
} else {
2424
seconds = '00';
2525
}
26-
miliseconds = JSON.stringify(miliseconds);
26+
miliseconds = Number.parseFloat(miliseconds).toFixed(2)
2727
const arrayMiliseconds = miliseconds.split('.');
2828
if (arrayMiliseconds[0].length < 2) {
2929
arrayMiliseconds[0] = '0'.concat(arrayMiliseconds[0]);
3030
}
31-
if (arrayMiliseconds[1].length > 3) {
32-
arrayMiliseconds[1] = arrayMiliseconds[1].slice(0, 2);
33-
}
3431
if (index == 0) {
3532
return `${seconds}:${arrayMiliseconds[0]}.${arrayMiliseconds[1]}`;
3633
}

src/app/components/Diff.jsx

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,43 @@ function Diff({ snapshot, show }) {
1717
} else {
1818
previous = snapshots[sliderIndex - 1];
1919
}
20+
21+
// gabi :: cleanning preview from stateless data
22+
const statelessCleanning = obj => {
23+
const newObj = { ...obj };
24+
if (newObj.name === 'nameless') {
25+
delete newObj.name;
26+
}
27+
if (newObj.componentData) {
28+
delete newObj.componentData;
29+
}
30+
if (newObj.state === 'stateless') {
31+
delete newObj.state;
32+
}
33+
if (newObj.stateSnaphot) {
34+
newObj.stateSnaphot = statelessCleanning(obj.stateSnaphot);
35+
}
36+
if (newObj.children) {
37+
newObj.children = [];
38+
if (obj.children.length > 0) {
39+
obj.children.forEach(element => {
40+
if (element.state !== 'stateless' || element.children.length > 0) {
41+
const clean = statelessCleanning(element);
42+
newObj.children.push(clean);
43+
}
44+
});
45+
}
46+
}
47+
return newObj;
48+
};
49+
// gabi :: just display statefull data
50+
const previousDisplay = statelessCleanning(previous);
2051
// Nate:: diff function returns a comparaison of two objects, one has an updated change
21-
const delta = diff(previous, snapshot);
52+
// gabi :: just display statefull data
53+
const delta = diff(previousDisplay, snapshot);
2254
// returns html in string
23-
const html = formatters.html.format(delta, previous);
55+
// gabi :: just display statefull data
56+
const html = formatters.html.format(delta, previousDisplay);
2457
if (show) formatters.html.showUnchanged();
2558
else formatters.html.hideUnchanged();
2659

src/app/components/StateRoute.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ const StateRoute = ({ snapshot, hierarchy, snapshots, viewIndex }) => {
3939
<Router>
4040
<div className="navbar">
4141
<NavLink className="router-link" activeClassName="is-active" exact to="/">
42-
State
42+
Tree
4343
</NavLink>
4444
<NavLink className="router-link" activeClassName="is-active" to="/chart">
4545
History
4646
</NavLink>
4747
<NavLink className="router-link" activeClassName="is-active" to="/performance">
48-
Rendering
48+
Performance
4949
</NavLink>
5050
</div>
5151
<Switch>

src/app/styles/components/_actionComponent.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515

1616
.action-component-text{
17-
margin-bottom: 10px;
17+
margin-bottom: 8px;
1818
}
1919

2020
.action-component.selected {

src/app/styles/components/_buttons.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
.time-button {
2222
outline: none;
2323
height: 20px;
24+
margin-bottom: 8px;
2425
width: 70px;
2526
border: none;
2627
border-radius: 3px;
@@ -31,6 +32,7 @@
3132

3233
.jump-button {
3334
@extend %button-shared;
35+
margin-bottom: 8px;
3436
width: 50px;
3537
opacity: 0;
3638
transform: rotateX(90deg);

src/app/styles/components/d3graph.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ div.tooltip {
9696
.perfContainer {
9797
display: block;
9898
margin: 0 -14px;
99-
background-color: hsl(152,80%,80%);
99+
background-color: hsl(221,16%,20%);
100100
/* border: 2px solid red; */
101101
}
102102

0 commit comments

Comments
 (0)