Move stackIndex existence check at if condition in SampleTooltipContents#5353
Conversation
canova
left a comment
There was a problem hiding this comment.
Thanks for the PR! It looks like the logic needs to be changed, see my comment below.
Also see my comment #5290 (comment) to how to reproduce it locally, so you can test it.
| const sampleTime = samples.time[sampleIndex]; | ||
| const stackIndex = samples.stack[sampleIndex]; | ||
| const hasSamples = samples.length > 0 && stackTable.length > 1; | ||
| const hasValidStackIndex = (stackIndex !== null) || (stackIndex !== undefined); |
There was a problem hiding this comment.
|| needs to be && here. We need to make sure that stack index is not null AND not undefined. (also there is an extra space on the right side of the or operator).
|
I'm not sure about this patch. If sampleIndex can be an invalid index, it means there's a bug somewhere else. |
yeah, |
|
Yeah, for the There is this case now:
So in this case we still have the same
We actually show the tooltip in case the sample is not there, but this case is slightly different. For example when you profile without the stack sampling, but you still capture the CPU usage, we will not sample; but every sample will only contain the CPU usage values. You can try this case locally by checking the For the |
Solves #5290