@@ -10,13 +10,15 @@ import { Dispatch, FC, SetStateAction, useCallback, useMemo, useState } from 're
1010import { useCachePersistor } from '@open-condo/apollo'
1111import { useDeepCompareEffect } from '@open-condo/codegen/utils/useDeepCompareEffect'
1212import { getClientSideSenderInfo } from '@open-condo/codegen/utils/userId'
13+ import { useFeatureFlags } from '@open-condo/featureflags/FeatureFlagsContext'
1314import { useAuth } from '@open-condo/next/auth'
1415import { useIntl } from '@open-condo/next/intl'
1516import { useOrganization } from '@open-condo/next/organization'
1617import { Alert , Button , Modal , Select , Space , Typography } from '@open-condo/ui'
1718
1819import { FormItem } from '@condo/domains/common/components/Form/FormItem'
1920import { useLayoutContext } from '@condo/domains/common/components/LayoutContext'
21+ import { HIDE_ORGANIZATION_REQUESTS } from '@condo/domains/common/constants/featureflags'
2022import { useMutationErrorHandler } from '@condo/domains/common/hooks/useMutationErrorHandler'
2123import { formatPhone } from '@condo/domains/common/utils/helpers'
2224
@@ -159,6 +161,8 @@ export const useOrganizationEmployeeRequests = () => {
159161 const userId = useMemo ( ( ) => user ?. id , [ user ?. id ] )
160162 const { employee } = useOrganization ( )
161163 const { addNotification } = useLayoutContext ( )
164+ const { useFlag } = useFeatureFlags ( )
165+ const isOrganizationRequestsHidden = useFlag ( HIDE_ORGANIZATION_REQUESTS )
162166
163167 const [ activeRequest , setActiveRequest ] = useState < ActiveOrganizationRequestType > ( null )
164168
@@ -168,7 +172,7 @@ export const useOrganizationEmployeeRequests = () => {
168172 loading : isEmployeesLoading ,
169173 } = useGetActualOrganizationEmployeesQuery ( {
170174 variables : { userId } ,
171- skip : ! userId || ! persistor ,
175+ skip : ! userId || ! persistor || isOrganizationRequestsHidden ,
172176 } )
173177 const userOrganizationIds = useMemo ( ( ) => actualEmployeesData ?. actualEmployees
174178 ?. map ( employee => employee ?. organization ?. id )
@@ -184,7 +188,7 @@ export const useOrganizationEmployeeRequests = () => {
184188 userOrganizationIds,
185189 } ,
186190 onError,
187- skip : ! user || ! employee || isEmployeesLoading ,
191+ skip : ! user || ! employee || isEmployeesLoading || isOrganizationRequestsHidden ,
188192 } )
189193 const [ acceptOrRejectRequest ] = useAcceptOrRejectOrganizationEmployeeRequestMutation ( {
190194 onError,
0 commit comments