Skip to content

Commit

Permalink
fix(business-reports): simplify query enabled condition
Browse files Browse the repository at this point in the history
- Remove unnecessary string check for reportType
- Simplify boolean conditions for enabling query

(your code had more checks than a paranoid mother-in-law)
  • Loading branch information
tomer-shvadron committed Dec 24, 2024
1 parent 831504f commit b498bc3
Showing 1 changed file with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useQuery } from '@tanstack/react-query';

import { isString } from '@/common/utils/is-string/is-string';
import { MerchantReportType } from '@/domains/business-reports/constants';
import { businessReportsQueryKey } from '@/domains/business-reports/query-keys';
import { TReportStatusValue, TRiskLevel } from '@/pages/MerchantMonitoring/schemas';
Expand Down Expand Up @@ -47,14 +46,7 @@ export const useBusinessReportsQuery = ({
from,
to,
}),
enabled:
isAuthenticated &&
isString(reportType) &&
!!reportType &&
!!sortBy &&
!!sortDir &&
!!page &&
!!pageSize,
enabled: isAuthenticated && !!sortBy && !!sortDir && !!page && !!pageSize,
staleTime: 100_000,
refetchInterval: 1_000_000,
});
Expand Down

0 comments on commit b498bc3

Please sign in to comment.