File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 8
8
import * as Dialog from '@radix-ui/react-dialog'
9
9
import cn from 'classnames'
10
10
import { matchSorter } from 'match-sorter'
11
- import React , { useState } from 'react'
11
+ import { useRef , useState } from 'react'
12
12
13
13
import { Close12Icon } from '@oxide/design-system/icons/react'
14
14
@@ -70,9 +70,9 @@ export function ActionMenu(props: ActionMenuProps) {
70
70
const [ selectedIdx , setSelectedIdx ] = useState ( 0 )
71
71
const selectedItem = itemsInOrder [ selectedIdx ] as QuickActionItem | undefined
72
72
73
- const divRef = React . createRef < HTMLDivElement > ( )
74
- const ulRef = React . createRef < HTMLUListElement > ( )
75
- const inputRef = React . createRef < HTMLInputElement > ( )
73
+ const divRef = useRef < HTMLDivElement > ( null )
74
+ const ulRef = useRef < HTMLUListElement > ( null )
75
+ const inputRef = useRef < HTMLInputElement > ( null )
76
76
77
77
useSteppedScroll ( divRef , ulRef , selectedIdx , LIST_HEIGHT )
78
78
Original file line number Diff line number Diff line change @@ -67,7 +67,11 @@ export function useSteppedScroll(
67
67
outer . scrollTo ( { top : itemBottomScrollTo - outerContainerHeight + 2 } )
68
68
}
69
69
}
70
- // don't depend on the refs because they get nuked on every render
71
- // eslint-disable-next-line react-hooks/exhaustive-deps
72
- } , [ outerContainerHeight , selectedIdx , itemSelector ] )
70
+ } , [
71
+ outerContainerRef ,
72
+ innerContainerRef ,
73
+ outerContainerHeight ,
74
+ selectedIdx ,
75
+ itemSelector ,
76
+ ] )
73
77
}
You can’t perform that action at this time.
0 commit comments