@@ -5,29 +5,29 @@ export const useDocSearch = () => {
55 const router = useRouter ( ) ;
66
77
8- useLayoutEffect ( ( ) => {
8+ useLayoutEffect ( ( ) => {
99 // @ts -ignore
10- let ds = docsearch ( {
10+ let ds = docsearch ( {
1111 apiKey : '0260af6591f616d3300bc3b89d75cfd1' ,
1212 indexName : 'nauchikus_typescript-definitive-guide' ,
1313 inputSelector : '#algolia-search' ,
1414 debug : false ,
1515 /// TODO: [refactoring] add types
16- handleSelected : function ( input : any , event : any , suggestion : any , datasetNumber : any , context : any ) {
17- if ( context . selectionMethod === 'click' ) {
18- input . setVal ( '' ) ;
16+ handleSelected : function ( input : any , event : any , suggestion : any , datasetNumber : any , context : any ) {
17+ if ( context . selectionMethod === 'click' ) {
18+ input . setVal ( '' ) ;
1919
2020 let url = suggestion . url ;
2121 let pattern = `/#gatsby-focus-wrapper` ;
2222
23- if ( url . endsWith ( pattern ) ) {
24- url = url . substring ( 0 , url . length - pattern . length ) ;
23+ if ( url . endsWith ( pattern ) ) {
24+ url = url . substring ( 0 , url . length - pattern . length ) ;
2525 }
2626
2727 let origin = `https://typescript-definitive-guide.ru` ;
2828
2929
30- if ( process . env . NODE_ENV === `development` ) {
30+ if ( process . env . NODE_ENV === `development` ) {
3131 origin = `http://localhost:8000` ;
3232
3333 url = url . replace (
@@ -37,24 +37,24 @@ export const useDocSearch = () => {
3737 }
3838
3939
40- url = url . replace ( origin , `` ) ;
40+ url = url . replace ( origin , `` ) ;
4141
4242 router . push ( url ) ;
4343 }
4444 }
45- } ) ;
45+ } ) ;
4646
47- let input = ds . autocomplete [ 0 ] ;
47+ let input = ds . autocomplete [ 0 ] ;
4848 let autocomplete = ds . autocomplete . autocomplete ;
4949
5050 const input_blurHandler = ( ) => {
51- autocomplete . setVal ( '' ) ;
51+ autocomplete . setVal ( '' ) ;
5252 } ;
5353
54- input . addEventListener ( `blur` , input_blurHandler ) ;
54+ input . addEventListener ( `blur` , input_blurHandler ) ;
5555
5656 return ( ) => {
57- input . removeEventListener ( `blur` , input_blurHandler ) ;
57+ input . removeEventListener ( `blur` , input_blurHandler ) ;
5858 } ;
59- } ) ;
59+ } , [ ] ) ;
6060}
0 commit comments