Skip to content

Instantly share code, notes, and snippets.

@gregtatum
Created September 27, 2019 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregtatum/39e31eae3255e3c4ba88abdc5479af3c to your computer and use it in GitHub Desktop.
Save gregtatum/39e31eae3255e3c4ba88abdc5479af3c to your computer and use it in GitHub Desktop.
diff --git a/src/components/stack-chart/Canvas.js b/src/components/stack-chart/Canvas.js
index c7d71e30..a5a1fe0b 100644
--- a/src/components/stack-chart/Canvas.js
+++ b/src/components/stack-chart/Canvas.js
@@ -420,8 +420,14 @@ class StackChartCanvas extends React.PureComponent<Props> {
const stackTiming = stackTimingByDepth[depth];
- if (!stackTiming.callNode) {
- return null;
+ if (stackTiming.markerIndex) {
+ const markerIndex = stackTiming.markerIndex[stackTimingIndex];
+ return (
+ <TooltipMarker
+ marker={getMarker(markerIndex)}
+ // and the other OwnProps
+ />
+ );
}
const callNodeIndex = stackTiming.callNode[stackTimingIndex];
@@ -454,10 +460,12 @@ class StackChartCanvas extends React.PureComponent<Props> {
});
};
+ // This will need to handle marker indexes, maybe returning a new type
_getCallNodeIndexFromHoveredItem(
hoveredItem: HoveredStackTiming | null
- ): IndexIntoCallNodeTable | null {
+ ): {| index: number, type: 'marker' | 'call-node' |} | null {
if (hoveredItem === null) {
+ // TODO - This will also need to be taught about marker index.
return null;
}
diff --git a/src/components/tooltip/CallNode.js b/src/components/tooltip/CallNode.js
index 14b180e7..5005d0e4 100644
--- a/src/components/tooltip/CallNode.js
+++ b/src/components/tooltip/CallNode.js
@@ -41,6 +41,7 @@ type Props = {|
timings?: TimingsForPath,
|};
+// This is the one that is already being used.
/**
* This class collects the tooltip rendering for anything that cares about call nodes.
* This includes the Flame Graph and Stack Chart.
diff --git a/src/components/tooltip/Marker.js b/src/components/tooltip/Marker.js
index b8b644f8..24817a1e 100644
--- a/src/components/tooltip/Marker.js
+++ b/src/components/tooltip/Marker.js
@@ -643,6 +643,7 @@ function getMarkerDetails(
);
}
+// These are the OwnProps which will need to be passed in from the stack chart.
type OwnProps = {|
+marker: Marker,
+threadIndex: ThreadIndex,
@@ -719,6 +720,7 @@ class MarkerTooltipContents extends React.PureComponent<Props> {
}
}
+// Here is the tooltip component for markers, which needs to be added.
export const TooltipMarker = explicitConnect<OwnProps, StateProps, {||}>({
mapStateToProps: (state, props) => {
const { threadIndex } = props;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment