-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move stackIndex existence check at if condition in SampleTooltipContents #5353
base: main
Are you sure you want to change the base?
Move stackIndex existence check at if condition in SampleTooltipContents #5353
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -136,8 +136,9 @@ export class SampleTooltipContents extends React.PureComponent<Props> { | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
||
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