@@ -58,7 +58,6 @@ const collectNodes = (snaps, componentName) => {
5858 // needs to be stringified because values are hard to determine if true or false if in they're seen as objects
5959 if ( JSON . stringify ( Object . values ( componentsResult [ newChange ? componentsResult . length - 1 : trackChanges ] ) [ 0 ] ) !== JSON . stringify ( cur . componentData . props ) ) {
6060 newChange = true ;
61- // const props = { [`snapshot${x}`]: { rendertime: formatRenderTime(cur.componentData.actualDuration), ...cur.componentData.props } };
6261 const props = { [ `snapshot${ x } ` ] : { ...cur . componentData . props } } ;
6362 componentsResult . push ( props ) ;
6463 } else {
@@ -68,8 +67,6 @@ const collectNodes = (snaps, componentName) => {
6867 componentsResult . push ( props ) ;
6968 }
7069 } else {
71- // const props = { [`snapshot${x}`]: { ...cur.componentData.props}};
72- // props[`snapshot${x}`].rendertime = formatRenderTime(cur.componentData.actualDuration);
7370 const props = { [ `snapshot${ x } ` ] : { ...cur . componentData . props } } ;
7471 componentsResult . push ( props ) ;
7572 }
@@ -138,7 +135,7 @@ const traverse = (snapshot, data, snapshots, currTotalRender = 0) => {
138135
139136// Retrieve snapshot series data from Chrome's local storage.
140137const allStorage = ( ) => {
141- let values = localStorage . getItem ( 'project' )
138+ let values = localStorage . getItem ( 'project' ) ;
142139 values = values === null ? [ ] : JSON . parse ( values ) ;
143140 return values ;
144141} ;
@@ -168,30 +165,28 @@ const getPerfMetrics = (snapshots, snapshotsIds): {} => {
168165 return perfData ;
169166} ;
170167
171-
172-
173168/* EXPORT COMPONENT */
174169const PerformanceVisx = ( props : BarStackProps ) => {
175170 // hook used to dispatch onhover action in rect
176- const { width, height, snapshots, hierarchy, } = props ;
171+ const {
172+ width, height, snapshots, hierarchy,
173+ } = props ;
177174 const [ { tabs, currentTab, currentTabInApp } , dispatch ] = useStoreContext ( ) ;
178- const [ detailsView , setDetailsView ] = useState ( 'barStack' ) ;
179- const [ comparisonView , setComparisonView ] = useState ( 'barStack' ) ;
180- const [ comparisonData , setComparisonData ] = useState ( ) ;
181175 const NO_STATE_MSG = 'No state change detected. Trigger an event to change state' ;
182176 const data = getPerfMetrics ( snapshots , getSnapshotIds ( hierarchy ) ) ;
183- const [ series , setSeries ] = useState ( true ) ;
184- const [ action , setAction ] = useState ( false ) ;
177+ const [ series , setSeries ] = useState ( true ) ;
178+ const [ action , setAction ] = useState ( false ) ;
185179
186180 useEffect ( ( ) => {
187181 dispatch ( setCurrentTabInApp ( 'performance' ) ) ;
188- } , [ ] ) ;
182+ } , [ dispatch ] ) ;
189183
184+ // Creates the actions array used to populate the compare actions dropdown
190185 const getActions = ( ) => {
191- let seriesArr = localStorage . getItem ( 'project' )
186+ let seriesArr = localStorage . getItem ( 'project' ) ;
192187 seriesArr = seriesArr === null ? [ ] : JSON . parse ( seriesArr ) ;
193188 const actionsArr = [ ] ;
194-
189+
195190 if ( seriesArr . length ) {
196191 for ( let i = 0 ; i < seriesArr . length ; i ++ ) {
197192 for ( const actionObj of seriesArr [ i ] . data . barStack ) {
@@ -203,22 +198,24 @@ const PerformanceVisx = (props: BarStackProps) => {
203198 }
204199 }
205200 return actionsArr ;
206- }
201+ } ;
207202
208203 const renderComparisonBargraph = ( ) => {
209- if ( hierarchy && series !== false ) return (
210- < BarGraphComparison
211- comparison = { allStorage ( ) }
212- data = { data }
213- width = { width }
214- height = { height }
215- setSeries = { setSeries }
216- series = { series }
217- setAction = { setAction }
218- />
219- ) ;
204+ if ( hierarchy && series !== false ) {
205+ return (
206+ < BarGraphComparison
207+ comparison = { allStorage ( ) }
208+ data = { data }
209+ width = { width }
210+ height = { height }
211+ setSeries = { setSeries }
212+ series = { series }
213+ setAction = { setAction }
214+ />
215+ ) ;
216+ }
220217 return (
221- < BarGraphComparisonActions
218+ < BarGraphComparisonActions
222219 comparison = { allStorage ( ) }
223220 data = { getActions ( ) }
224221 width = { width }
@@ -243,13 +240,12 @@ const PerformanceVisx = (props: BarStackProps) => {
243240 return < div className = "noState" > { NO_STATE_MSG } </ div > ;
244241 } ;
245242
243+ // This will redirect to the proper tabs during the tutorial
246244 const renderForTutorial = ( ) => {
247- console . log ( currentTabInApp )
248245 if ( currentTabInApp === 'performance' ) return < Redirect to = "/" /> ;
249246 if ( currentTabInApp === 'performance-comparison' ) return < Redirect to = "/comparison" /> ;
250-
251247 return null ;
252- }
248+ } ;
253249
254250 return (
255251 < Router >
0 commit comments