File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
packages/docsearch-react/src Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import {
1616} from './types' ;
1717import { useDocSearchKeyboardEvents } from './useDocSearchKeyboardEvents' ;
1818
19- const { useState, useEffect , useCallback, useRef } = React ;
19+ const { useState, useCallback, useRef } = React ;
2020
2121const ACTION_KEY_APPLE = '⌘' as const ;
2222const ACTION_KEY_DEFAULT = 'Ctrl' as const ;
@@ -52,15 +52,14 @@ export function DocSearch(props: DocSearchProps) {
5252 undefined
5353 ) ;
5454
55- const [ key , setKey ] = useState <
55+ const [ key ] = useState <
5656 typeof ACTION_KEY_APPLE | typeof ACTION_KEY_DEFAULT | null
57- > ( null ) ;
58-
59- useEffect ( ( ) => {
57+ > ( ( ) => {
6058 if ( typeof navigator !== 'undefined' ) {
61- setKey ( isAppleDevice ( ) ? ACTION_KEY_APPLE : ACTION_KEY_DEFAULT ) ;
59+ return isAppleDevice ( ) ? ACTION_KEY_APPLE : ACTION_KEY_DEFAULT ;
6260 }
63- } , [ ] ) ;
61+ return null ;
62+ } ) ;
6463
6564 const onOpen = useCallback ( ( ) => {
6665 setIsOpen ( true ) ;
@@ -98,7 +97,6 @@ export function DocSearch(props: DocSearchProps) {
9897 </ span >
9998 ) : undefined }
10099 </ DocSearchButton >
101-
102100 { isOpen &&
103101 createPortal (
104102 < DocSearchModal
You can’t perform that action at this time.
0 commit comments