fix(projects): fetch projects if the feature was enabled.

This commit is contained in:
a.bouhuolia
2023-01-23 16:38:36 +02:00
parent 7de66f16ce
commit 31d665e91e
7 changed files with 22 additions and 12 deletions

View File

@@ -27,6 +27,7 @@ function PaymentReceiveFormProvider({ query, paymentReceiveId, ...props }) {
// Features guard.
const { featureCan } = useFeatureCan();
const isBranchFeatureCan = featureCan(Features.Branches);
const isProjectsFeatureCan = featureCan(Features.Projects);
// Fetches payment recevie details.
const {
@@ -62,7 +63,7 @@ function PaymentReceiveFormProvider({ query, paymentReceiveId, ...props }) {
const {
data: { projects },
isLoading: isProjectsLoading,
} = useProjects();
} = useProjects({}, { enabled: !!isProjectsFeatureCan });
// Detarmines whether the new mode.
const isNewMode = !paymentReceiveId;
@@ -82,7 +83,7 @@ function PaymentReceiveFormProvider({ query, paymentReceiveId, ...props }) {
customers,
branches,
projects,
isPaymentLoading,
isAccountsLoading,
isPaymentFetching,