From 746662e52d5b983d5279bc51d11a0387ae68fcee Mon Sep 17 00:00:00 2001 From: jennypavlova Date: Mon, 26 Aug 2024 16:36:30 +0200 Subject: [PATCH] [Infra] Fix react query closing x in a non development env (#191276) Closes [#190220](https://github.com/elastic/kibana/issues/190220) ## Summary This PR removes the `x` icon used to close the react query dev tools which appeared in a non-development environment by restricting it to appear only in development mode. | before | after | |-------|-------| | image | image | In a development environment, the icon stays and works as before: image --- .../infra/public/containers/react_query_provider.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/observability_solution/infra/public/containers/react_query_provider.tsx b/x-pack/plugins/observability_solution/infra/public/containers/react_query_provider.tsx index ee49e9cd081e0e..cc47833ae3217c 100644 --- a/x-pack/plugins/observability_solution/infra/public/containers/react_query_provider.tsx +++ b/x-pack/plugins/observability_solution/infra/public/containers/react_query_provider.tsx @@ -6,6 +6,7 @@ */ import React, { useState } from 'react'; +import { i18n } from '@kbn/i18n'; import { QueryClient, QueryClientConfig, QueryClientProvider } from '@tanstack/react-query'; import merge from 'lodash/merge'; import { EuiButtonIcon } from '@elastic/eui'; @@ -36,7 +37,7 @@ export function ReactQueryProvider({ children, config = {} }: ProviderProps) { function HideableReactQueryDevTools() { const [isHidden, setIsHidden] = useState(false); - return !isHidden ? ( + return !isHidden && process.env.NODE_ENV === 'development' ? (
setIsHidden(!isHidden)} - aria-label="Disable React Query Dev Tools" + aria-label={i18n.translate( + 'xpack.infra.hideableReactQueryDevTools.euiButtonIcon.disableReactQueryDevLabel', + { defaultMessage: 'Disable React Query Dev Tools' } + )} />