Skip to content

Commit aa25824

Browse files
author
Brian Vaughn
authored
Scheduling profiler: Fix tooltip wheel event regression (#22130)
Panning horizontally via mouse wheel used to allow you to scrub over snapshot images. This was accidentally broken by a recent change. The core of the fix for this was to update `useSmartTooltip()` to remove the dependencies array so that a newly rendered tooltip is positioned even if the mouseX/mouseY coordinates don't change (as they don't when panning via wheel). I also cleaned a couple of unrelated things up while doing this: * Consolidated hover reset logic formerly split between `CanvasPage` and `Surface` into the `Surface` `handleInteraction()` function. * Cleaned up redundant ref setting code in EventTooltip.
1 parent 42ef45b commit aa25824

File tree

4 files changed

+102
-203
lines changed

4 files changed

+102
-203
lines changed

packages/react-devtools-scheduling-profiler/src/CanvasPage.js

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -419,44 +419,6 @@ function AutoSizedCanvas({
419419
return;
420420
}
421421

422-
// Wheel events should always hide the current tooltip.
423-
switch (interaction.type) {
424-
case 'wheel-control':
425-
case 'wheel-meta':
426-
case 'wheel-plain':
427-
case 'wheel-shift':
428-
setHoveredEvent(prevHoverEvent => {
429-
if (prevHoverEvent === null) {
430-
return prevHoverEvent;
431-
} else if (
432-
prevHoverEvent.componentMeasure !== null ||
433-
prevHoverEvent.flamechartStackFrame !== null ||
434-
prevHoverEvent.measure !== null ||
435-
prevHoverEvent.nativeEvent !== null ||
436-
prevHoverEvent.networkMeasure !== null ||
437-
prevHoverEvent.schedulingEvent !== null ||
438-
prevHoverEvent.snapshot !== null ||
439-
prevHoverEvent.suspenseEvent !== null ||
440-
prevHoverEvent.userTimingMark !== null
441-
) {
442-
return {
443-
componentMeasure: null,
444-
flamechartStackFrame: null,
445-
measure: null,
446-
nativeEvent: null,
447-
networkMeasure: null,
448-
schedulingEvent: null,
449-
snapshot: null,
450-
suspenseEvent: null,
451-
userTimingMark: null,
452-
};
453-
} else {
454-
return prevHoverEvent;
455-
}
456-
});
457-
break;
458-
}
459-
460422
const surface = surfaceRef.current;
461423
surface.handleInteraction(interaction);
462424

0 commit comments

Comments
 (0)