Flame Graph: Fix Copy Function Name (#64970)

Fix getting the function name when clicking the Copy Function Name context menu item of the flame graph
This commit is contained in:
Andre Pereira
2023-03-20 08:57:03 +00:00
committed by GitHub
parent 4ee0be6fdf
commit 67fe282f7e
2 changed files with 4 additions and 1 deletions
@@ -269,6 +269,7 @@ const FlameGraph = ({
setSelectedBarIndex={setSelectedBarIndex}
setRangeMin={setRangeMin}
setRangeMax={setRangeMax}
getLabelValue={getLabelValue}
/>
)}
</div>
@@ -16,6 +16,7 @@ type Props = {
setSelectedBarIndex: (bar: number) => void;
setRangeMin: (range: number) => void;
setRangeMax: (range: number) => void;
getLabelValue: (label: string | number) => string;
};
const FlameGraphContextMenu = ({
@@ -28,6 +29,7 @@ const FlameGraphContextMenu = ({
setSelectedBarIndex,
setRangeMin,
setRangeMax,
getLabelValue,
}: Props) => {
const renderMenuItems = () => {
return (
@@ -55,7 +57,7 @@ const FlameGraphContextMenu = ({
onClick={() => {
if (graphRef.current && contextMenuData) {
const bar = levels[contextMenuData.levelIndex][contextMenuData.barIndex];
navigator.clipboard.writeText(bar.label).then(() => {
navigator.clipboard.writeText(getLabelValue(bar.label)).then(() => {
setContextMenuData(undefined);
});
}