File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
packages/docsearch-react/src Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 1- import React , { useState } from 'react' ;
1+ import React , { useMemo } from 'react' ;
22
33import { ControlKeyIcon } from './icons/ControlKeyIcon' ;
44import { SearchIcon } from './icons/SearchIcon' ;
@@ -25,14 +25,14 @@ export const DocSearchButton = React.forwardRef<
2525> ( ( { translations = { } , ...props } , ref ) => {
2626 const { buttonText = 'Search' , buttonAriaLabel = 'Search' } = translations ;
2727
28- const [ key ] = useState <
28+ const key = useMemo <
2929 typeof ACTION_KEY_APPLE | typeof ACTION_KEY_DEFAULT | null
3030 > ( ( ) => {
3131 if ( typeof navigator !== 'undefined' ) {
3232 return isAppleDevice ( ) ? ACTION_KEY_APPLE : ACTION_KEY_DEFAULT ;
3333 }
3434 return null ;
35- } ) ;
35+ } , [ ] ) ;
3636
3737 return (
3838 < button
You can’t perform that action at this time.
0 commit comments