diff --git a/lib/api/useUniversalProfileApiFetch.ts b/lib/api/useUniversalProfileApiFetch.ts index e4a8041fee..9eeea0a0b3 100644 --- a/lib/api/useUniversalProfileApiFetch.ts +++ b/lib/api/useUniversalProfileApiFetch.ts @@ -6,6 +6,7 @@ import type { UniversalProfileProxyResponse } from '../../types/api/universalPro import type { Params as FetchParams } from 'lib/hooks/useFetch'; import { algoliaIndex } from './buildUniversalProfileUrl'; +import { isUniversalProfileEnabled } from './isUniversalProfileEnabled'; import type { ResourceName, ResourcePathParams } from './resources'; export interface Params { @@ -17,6 +18,9 @@ export interface Params { export default function useUniversalProfileApiFetch() { return React.useCallback(async(queryParams: string, ) => { + if (!isUniversalProfileEnabled()) { + return [] as Array; + } try { const { hits } = await algoliaIndex.search(queryParams); return hits.map((hit) => {