Timestamp:
{formatTimestamp(timestamp)}
@@ -210,24 +182,28 @@ const TooltipFlamechartNode = ({
};
const TooltipReactEvent = ({
- color,
event,
tooltipRef,
}: {
- color: string,
event: ReactEvent,
tooltipRef: Return
,
}) => {
- const {componentName, componentStack, timestamp, type} = event;
- const label = getReactEventLabel(type);
+ const label = getReactEventLabel(event.type);
+ const color = getReactEventColor(event);
+ if (!label || !color) {
+ console.warn(`Unexpected event type "${event.type}"`);
+ return null;
+ }
+
+ const {componentName, componentStack, timestamp} = event;
return (
{componentName && (
- {trimComponentName(componentName)}
+ {trimmedString(componentName, 768)}
- )}{' '}
+ )}
{label}
@@ -255,13 +231,19 @@ const TooltipReactMeasure = ({
measure: ReactMeasure,
tooltipRef: Return
,
}) => {
- const {batchUID, duration, timestamp, type, lanes} = measure;
- const label = getReactMeasureLabel(type);
+ const label = getReactMeasureLabel(measure.type);
+ if (!label) {
+ console.warn(`Unexpected measure type "${measure.type}"`);
+ return null;
+ }
+
+ const {batchUID, duration, timestamp, lanes} = measure;
const [startTime, stopTime] = getBatchRange(batchUID, data);
return (
- {formatDuration(duration)} {label}
+ {formatDuration(duration)}
+
{label}
Timestamp:
@@ -287,7 +269,7 @@ const TooltipUserTimingMark = ({
const {name, timestamp} = mark;
return (
- {name}
+
{name}
Timestamp:
diff --git a/src/utils/useSmartTooltip.js b/src/utils/useSmartTooltip.js
index 652721f96d2ad..fede223a231ad 100644
--- a/src/utils/useSmartTooltip.js
+++ b/src/utils/useSmartTooltip.js
@@ -57,7 +57,7 @@ export default function useSmartTooltip({
element.style.left = `${mouseX + TOOLTIP_OFFSET}px`;
}
}
- });
+ }, [mouseX, mouseY, ref]);
return ref;
}