diff --git a/src/common-components/data/apiHook.ts b/src/common-components/data/apiHook.ts index a09dfc59..f3bd4b73 100644 --- a/src/common-components/data/apiHook.ts +++ b/src/common-components/data/apiHook.ts @@ -6,11 +6,12 @@ import { ThirdPartyAuthQueryKeys } from './queryKeys'; // Error constants export const THIRD_PARTY_AUTH_ERROR = 'third-party-auth-error'; -const useThirdPartyAuthHook = (pageId, payload) => useQuery({ +const useThirdPartyAuthHook = (pageId, payload, { enabled = true } = {}) => useQuery({ queryKey: ThirdPartyAuthQueryKeys.byPage(pageId, payload), queryFn: () => getThirdPartyAuthContext(payload), retry: false, staleTime: 5 * 60 * 1000, // 5 minutes — TPA context is effectively static per session + enabled, }); export { diff --git a/src/progressive-profiling/ProgressiveProfiling.jsx b/src/progressive-profiling/ProgressiveProfiling.jsx index 320c22f3..b6c10105 100644 --- a/src/progressive-profiling/ProgressiveProfiling.jsx +++ b/src/progressive-profiling/ProgressiveProfiling.jsx @@ -77,7 +77,7 @@ const ProgressiveProfilingInner = () => { const [showModal, setShowModal] = useState(false); const { data, isSuccess, error } = useThirdPartyAuthHook(AUTHN_PROGRESSIVE_PROFILING, - { is_welcome_page: true, next: queryParams?.next }); + { is_welcome_page: true, next: queryParams?.next }, { enabled: registrationEmbedded }); useEffect(() => { if (registrationEmbedded) {