33 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44import { PureComponent } from 'react' ;
55import classNames from 'classnames' ;
6- import { ensureExists } from 'firefox-profiler/utils/types' ;
76import { timeCode } from 'firefox-profiler/utils/time-code' ;
87import { getSampleIndexClosestToStartTime } from 'firefox-profiler/profile-logic/profile-data' ;
98import { bisectionRight } from 'firefox-profiler/utils/bisect' ;
@@ -105,6 +104,8 @@ export class ThreadHeightGraph extends PureComponent<Props> {
105104 firstDrawnSampleIndex
106105 ) ;
107106
107+ const idleCategoryIndex = categories . findIndex ( ( c ) => c . name === 'Idle' ) ;
108+
108109 // Do one pass over the samples array to gather the samples we want to draw.
109110 const regularSamples = {
110111 height : [ ] as number [ ] ,
@@ -127,6 +128,12 @@ export class ThreadHeightGraph extends PureComponent<Props> {
127128 if ( sampleTime < nextMinTime ) {
128129 continue ;
129130 }
131+
132+ const state = sampleSelectedStates [ i ] as SelectedState ;
133+ if ( state === SelectedState . FilteredOutByTransform ) {
134+ continue ;
135+ }
136+
130137 const heightFuncResult = heightFunc ( i ) ;
131138 if ( heightFuncResult === null ) {
132139 continue ;
@@ -136,16 +143,11 @@ export class ThreadHeightGraph extends PureComponent<Props> {
136143
137144 const xPos = ( sampleTime - range [ 0 ] ) * xPixelsPerMs ;
138145 let samplesBucket ;
139- if ( sampleSelectedStates [ i ] === ( SelectedState . Selected as number ) ) {
146+ if ( state === SelectedState . Selected ) {
140147 samplesBucket = highlightedSamples ;
141148 } else {
142- const stackIndex = ensureExists (
143- thread . samples . stack [ i ] ,
144- 'A stack must exist for this sample, since a callNodeIndex exists.'
145- ) ;
146- const categoryIndex = thread . stackTable . category [ stackIndex ] ;
147- const category = categories [ categoryIndex ] ;
148- if ( category . name === 'Idle' ) {
149+ const categoryIndex = thread . samples . category [ i ] ;
150+ if ( categoryIndex === idleCategoryIndex ) {
149151 samplesBucket = idleSamples ;
150152 } else {
151153 samplesBucket = regularSamples ;
0 commit comments