diff --git a/jsapp/js/account/organization/organizationQuery.ts b/jsapp/js/account/organization/organizationQuery.ts index 6eda653dea..22994aca18 100644 --- a/jsapp/js/account/organization/organizationQuery.ts +++ b/jsapp/js/account/organization/organizationQuery.ts @@ -5,7 +5,6 @@ import {useEffect} from 'react'; // Stores, hooks and utilities import {fetchGetUrl, fetchPatch} from 'jsapp/js/api'; import {FeatureFlag, useFeatureFlag} from 'js/featureFlags'; -import sessionStore from 'js/stores/session'; import {useSession} from 'jsapp/js/stores/useSession'; // Constants and types @@ -106,16 +105,12 @@ export const useOrganizationQuery = (options?: Omit({ ...options, queryFn: fetchOrganization, queryKey: [QueryKeys.organization], - enabled: isQueryEnabled && options?.enabled !== false, + enabled: !!organizationUrl && options?.enabled !== false, }); // `organizationUrl` must exist, unless it's changed (e.g. user added/removed @@ -125,7 +120,7 @@ export const useOrganizationQuery = (options?: Omit { if (query.error?.status === 404) { - sessionStore.refreshAccount(); + session.refreshAccount(); } }, [query.error?.status]);