Skip to content

Commit 0fbb9b3

Browse files
authored
[DevTools] Don't highlight on timeline (facebook#34861)
I find it very frustrating that the highlight covers up the content that I'm trying to review when stepping through the timeline. It also triggered on keyboard navigation due to the focus which was annoying. We could highlight something in the rects instead potentially.
1 parent e096403 commit 0fbb9b3

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseScrubber.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ export default function SuspenseScrubber({
3131
max: number,
3232
value: number,
3333
highlight: number,
34-
onBlur: () => void,
34+
onBlur?: () => void,
3535
onChange: (index: number) => void,
36-
onFocus: () => void,
36+
onFocus?: () => void,
3737
onHoverSegment: (index: number) => void,
3838
onHoverLeave: () => void,
3939
}): React$Node {

packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTimeline.js

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import * as React from 'react';
1111
import {useContext, useEffect} from 'react';
1212
import {BridgeContext} from '../context';
1313
import {TreeDispatcherContext} from '../Components/TreeContext';
14-
import {useHighlightHostInstance, useScrollToHostInstance} from '../hooks';
14+
import {useScrollToHostInstance} from '../hooks';
1515
import {
1616
SuspenseTreeDispatcherContext,
1717
SuspenseTreeStateContext,
@@ -25,8 +25,6 @@ function SuspenseTimelineInput() {
2525
const bridge = useContext(BridgeContext);
2626
const treeDispatch = useContext(TreeDispatcherContext);
2727
const suspenseTreeDispatch = useContext(SuspenseTreeDispatcherContext);
28-
const {highlightHostInstance, clearHighlightHostInstance} =
29-
useHighlightHostInstance();
3028
const scrollToHostInstance = useScrollToHostInstance();
3129

3230
const {timeline, timelineIndex, hoveredTimelineIndex, playing, autoScroll} =
@@ -37,7 +35,6 @@ function SuspenseTimelineInput() {
3735

3836
function switchSuspenseNode(nextTimelineIndex: number) {
3937
const nextSelectedSuspenseID = timeline[nextTimelineIndex];
40-
highlightHostInstance(nextSelectedSuspenseID);
4138
treeDispatch({
4239
type: 'SELECT_ELEMENT_BY_ID',
4340
payload: nextSelectedSuspenseID,
@@ -52,23 +49,14 @@ function SuspenseTimelineInput() {
5249
switchSuspenseNode(pendingTimelineIndex);
5350
}
5451

55-
function handleBlur() {
56-
clearHighlightHostInstance();
57-
}
58-
5952
function handleFocus() {
6053
switchSuspenseNode(timelineIndex);
6154
}
6255

6356
function handleHoverSegment(hoveredValue: number) {
64-
const suspenseID = timeline[hoveredValue];
65-
if (suspenseID === undefined) {
66-
throw new Error(
67-
`Suspense node not found for value ${hoveredValue} in timeline.`,
68-
);
69-
}
70-
highlightHostInstance(suspenseID);
57+
// TODO: Consider highlighting the rect instead.
7158
}
59+
function handleUnhoverSegment() {}
7260

7361
function skipPrevious() {
7462
const nextSelectedSuspenseID = timeline[timelineIndex - 1];
@@ -180,11 +168,10 @@ function SuspenseTimelineInput() {
180168
max={max}
181169
value={timelineIndex}
182170
highlight={hoveredTimelineIndex}
183-
onBlur={handleBlur}
184171
onChange={handleChange}
185172
onFocus={handleFocus}
186173
onHoverSegment={handleHoverSegment}
187-
onHoverLeave={clearHighlightHostInstance}
174+
onHoverLeave={handleUnhoverSegment}
188175
/>
189176
</div>
190177
</>

0 commit comments

Comments
 (0)