import { useMemo } from 'react' ; import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params' ; export function useUxQuery ( ) { const { urlParams , uxUiFilters } = useLegacyUrlParams ( ) ; const { start , end , searchTerm , percentile } = urlParams ; const queryParams = useMemo ( ( ) => { const { serviceName } = uxUiFilters ; if ( start && end && serviceName && percentile ) { return { start , end , percentile : String ( percentile ) , urlQuery : searchTerm || undefined , uiFilters : JSON . stringify ( uxUiFilters ) , } ; } return null ; } , [ start , end , searchTerm , percentile , uxUiFilters ] ) ; return queryParams ; }