@@ -13,9 +13,9 @@ import {
1313 EuiLoadingSpinner ,
1414} from '@elastic/eui'
1515import { css } from '@emotion/react'
16+ import { useQuery } from '@tanstack/react-query'
1617import * as React from 'react'
1718import { useEffect , Suspense , lazy } from 'react'
18- import { useQuery } from '@tanstack/react-query'
1919
2020// Lazy load the modal component
2121const SearchOrAskAiModal = lazy ( ( ) =>
@@ -29,16 +29,16 @@ export const SearchOrAskAiButton = () => {
2929 const { clearSearchTerm } = useSearchActions ( )
3030 const isModalOpen = useModalIsOpen ( )
3131 const { openModal, closeModal, toggleModal } = useModalActions ( )
32-
32+
3333 const { data : isApiAvailable } = useQuery ( {
34- queryKey : [ 'api-health' ] ,
35- queryFn : async ( ) => {
36- const response = await fetch ( '/docs/_api/v1/' , { method : 'HEAD' } )
37- return response . ok
38- } ,
39- staleTime : 5 * 60 * 1000 , // 5 minutes
40- retry : false
41- } )
34+ queryKey : [ 'api-health' ] ,
35+ queryFn : async ( ) => {
36+ const response = await fetch ( '/docs/_api/v1/' , { method : 'HEAD' } )
37+ return response . ok
38+ } ,
39+ staleTime : 5 * 60 * 1000 , // 5 minutes
40+ retry : false ,
41+ } )
4242
4343 const positionCss = css `
4444 position : absolute;
@@ -72,7 +72,7 @@ export const SearchOrAskAiButton = () => {
7272 window . removeEventListener ( 'keydown' , handleKeydown )
7373 }
7474 } , [ ] )
75-
75+
7676 if ( ! isApiAvailable ) {
7777 return null
7878 }
0 commit comments