8
8
*/
9
9
10
10
import * as React from 'react' ;
11
- import { useCallback , useEffect , useMemo , useRef , useState } from 'react' ;
11
+ import { useEffect , useMemo , useRef } from 'react' ;
12
12
import AutoSizer from 'react-virtualized-auto-sizer' ;
13
13
import { FixedSizeList } from 'react-window' ;
14
14
import SnapshotCommitListItem from './SnapshotCommitListItem' ;
@@ -20,7 +20,6 @@ export type ItemData = {|
20
20
commitDurations : Array < number > ,
21
21
commitTimes : Array < number > ,
22
22
filteredCommitIndices : Array < number > ,
23
- isMouseDown : boolean ,
24
23
maxDuration : number ,
25
24
selectedCommitIndex : number | null ,
26
25
selectedFilteredCommitIndex : number | null ,
@@ -97,28 +96,6 @@ function List({
97
96
}
98
97
} , [ listRef , selectedFilteredCommitIndex ] ) ;
99
98
100
- // When the mouse is down, dragging over a commit should auto-select it.
101
- // This provides a nice way for users to swipe across a range of commits to compare them.
102
- const [ isMouseDown , setIsMouseDown ] = useState ( false ) ;
103
- const handleMouseDown = useCallback ( ( ) => {
104
- setIsMouseDown ( true ) ;
105
- } , [ ] ) ;
106
- const handleMouseUp = useCallback ( ( ) => {
107
- setIsMouseDown ( false ) ;
108
- } , [ ] ) ;
109
- useEffect ( ( ) => {
110
- if ( divRef . current === null ) {
111
- return ( ) => { } ;
112
- }
113
-
114
- // It's important to listen to the ownerDocument to support the browser extension.
115
- // Here we use portals to render individual tabs (e.g. Profiler),
116
- // and the root document might belong to a different window.
117
- const ownerDocument = divRef . current . ownerDocument ;
118
- ownerDocument . addEventListener ( 'mouseup' , handleMouseUp ) ;
119
- return ( ) => ownerDocument . removeEventListener ( 'mouseup' , handleMouseUp ) ;
120
- } , [ divRef , handleMouseUp ] ) ;
121
-
122
99
const itemSize = useMemo (
123
100
( ) => Math . max ( minBarWidth , width / filteredCommitIndices . length ) ,
124
101
[ filteredCommitIndices , width ] ,
@@ -134,7 +111,6 @@ function List({
134
111
commitDurations,
135
112
commitTimes,
136
113
filteredCommitIndices,
137
- isMouseDown,
138
114
maxDuration,
139
115
selectedCommitIndex,
140
116
selectedFilteredCommitIndex,
@@ -144,7 +120,6 @@ function List({
144
120
commitDurations ,
145
121
commitTimes ,
146
122
filteredCommitIndices ,
147
- isMouseDown ,
148
123
maxDuration ,
149
124
selectedCommitIndex ,
150
125
selectedFilteredCommitIndex ,
@@ -153,11 +128,7 @@ function List({
153
128
) ;
154
129
155
130
return (
156
- < div
157
- onMouseDown = { handleMouseDown }
158
- onMouseUp = { handleMouseUp }
159
- ref = { divRef }
160
- style = { { height, width} } >
131
+ < div ref = { divRef } style = { { height, width} } >
161
132
< FixedSizeList
162
133
className = { styles . List }
163
134
layout = "horizontal"
0 commit comments