Skip to content

Commit ba2f44f

Browse files
committed
fix the bug where the default snapshot in the graph is not correct
1 parent ecd0b14 commit ba2f44f

File tree

9 files changed

+222
-140
lines changed

9 files changed

+222
-140
lines changed

src/app/components/BarGraph.tsx

Lines changed: 202 additions & 128 deletions
Large diffs are not rendered by default.

src/app/components/ComponentMap.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,13 @@ export default function ComponentMap({
217217

218218
// find the node that has been selected and use it as the root
219219
const startNode = null;
220+
let rootNode;
220221
const findSelectedNode = () => {
221222
for (const node of nodeList) {
222-
if (node.name === selectedNode) {
223-
startNode = node;
224-
}
223+
if (node.name === 'root') rootNode = node;
224+
if (node.name === selectedNode) startNode = node;
225225
}
226+
if (startNode === null) startNode = rootNode;
226227
};
227228
findSelectedNode();
228229

src/app/components/LinkControls.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const collectNodes = (node) => {
4747
}
4848
}
4949
}
50-
}
50+
};
5151

5252
export default function LinkControls({
5353
layout,
@@ -113,7 +113,7 @@ export default function LinkControls({
113113
<label> Select:</label>
114114
&nbsp; {/*This is a non-breaking space - Prevents an automatic line break at this position */}
115115
<input id='selectInput' list='nodeOptions' type='text' name="nodeOptions"
116-
onChange={e => { setSelectedNode(e.target.value) }}
116+
onChange={e => setSelectedNode(e.target.value)}
117117
style={dropDownStyle}
118118
/>
119119
<datalist id='nodeOptions'>

src/app/components/PerformanceVisx.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ const collectNodes = (snaps, componentName) => {
5454
} else {
5555
renderResult.push(renderTime);
5656
}
57-
// compare the last pushed component Data from the array to the current one to see if there are differences
57+
// compare the last pushed component Data from the array to
58+
// the current one to see if there are differences
5859
if (x !== 0 && componentsResult.length !== 0) {
59-
// needs to be stringified because values are hard to determine if true or false if in they're seen as objects
60+
// needs to be stringified because values are hard to determine if
61+
// true or false if in they're seen as objects
6062
if (JSON.stringify(Object.values(componentsResult[newChange ? componentsResult.length - 1 : trackChanges])[0]) !== JSON.stringify(cur.componentData.props)) {
6163
newChange = true;
6264
const props = { [`snapshot${x}`]: { ...cur.componentData.props } };
@@ -301,6 +303,7 @@ const PerformanceVisx = (props: BarStackProps) => {
301303
allRoutes={allRoutes}
302304
filteredSnapshots={filteredSnapshots}
303305
setSnapshot={setSnapshot}
306+
snapshot={snapshot}
304307
/>
305308
</div>
306309
);

src/app/constants/actionTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ export const SAVE = 'SAVE';
2323
export const DELETE_SERIES = 'DELETE_SERIES';
2424
export const SET_CURRENT_LOCATION = 'SET_CURRENT_LOCATION';
2525
export const SET_CURRENT_TAB_IN_APP = 'SET_CURRENT_TAB_IN_APP';
26-
export const TUTORIAL_SAVE_SERIES_TOGGLE = 'TUTORIAL_SAVE_SERIES_TOGGLE';
26+
export const TUTORIAL_SAVE_SERIES_TOGGLE = 'TUTORIAL_SAVE_SERIES_TOGGLE';

src/app/reducers/mainReducer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default (state, action) => produce(state, draft => {
3434
}
3535
}
3636
};
37-
37+
3838
switch (action.type) {
3939
// This saves the series user wants to save to chrome local storage
4040
case types.SAVE: {

src/app/styles/components/_performanceVisx.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
text-align: left;
3838
}
3939

40-
#routes-select {
40+
#routes-select, #snapshot-select{
4141
color: white !important;
4242
background-color: #ff6569 !important;
4343
font: 400 14px 'Roboto', sans-serif;
@@ -48,6 +48,7 @@
4848
text-align: center;
4949
}
5050

51+
5152
#seriesname {
5253
float: right;
5354
width: 220px;

src/backend/linkFiber.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import AtomsRelationship from '../app/components/AtomsRelationship';
3939
declare global {
4040
interface Window {
4141
__REACT_DEVTOOLS_GLOBAL_HOOK__?: any;
42+
__REDUX_DEVTOOLS_EXTENSION__?: any;
4243
}
4344
}
4445
let fiberRoot = null;

src/extension/background.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ function createTabObj(title) {
2222
// update tabsObj
2323
return {
2424
title,
25-
// snapshots is an array of ALL state snapshots for stateful and stateless components the Reactime tab working on a specific user application
25+
// snapshots is an array of ALL state snapshots for stateful and stateless
26+
// components the Reactime tab working on a specific user application
2627
snapshots: [],
2728
// index here is the tab index that shows total amount of state changes
2829
index: 0,
29-
//* this is our pointer so we know what the current state the user is checking (this accounts for time travel aka when user clicks jump on the UI)
30+
//* this is our pointer so we know what the current state the user
31+
// is checking (this accounts for time travel aka when user clicks jump on the UI)
3032
currLocation: null,
3133
// points to the node that will generate the next child set by newest node or jump
3234
currParent: 0,

0 commit comments

Comments
 (0)