Skip to content

Commit 02bd445

Browse files
authored
[DevTools] Double clicking the root should jump to the beginning of the timeline (facebook#34704)
Unlike the rects, this never toggles. It just jumps.
1 parent 0eebd37 commit 02bd445

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,12 +330,25 @@ function SuspenseRectsContainer(): React$Node {
330330
});
331331
}
332332

333+
function handleDoubleClick(event: SyntheticMouseEvent) {
334+
if (event.defaultPrevented) {
335+
// Already clicked on an inner rect
336+
return;
337+
}
338+
event.preventDefault();
339+
suspenseTreeDispatch({
340+
type: 'SUSPENSE_SET_TIMELINE_INDEX',
341+
payload: 0,
342+
});
343+
}
344+
333345
const isRootSelected = roots.includes(inspectedElementID);
334346

335347
return (
336348
<div
337349
className={styles.SuspenseRectsContainer}
338350
onClick={handleClick}
351+
onDoubleClick={handleDoubleClick}
339352
data-highlighted={isRootSelected}>
340353
<ViewBox.Provider value={boundingBox}>
341354
<div

0 commit comments

Comments
 (0)