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

@@ -24,6 +24,7 @@ function MakeJournalProvider({ journalId, query, ...props }) {
// Features guard.
const { featureCan } = useFeatureCan();
const isBranchFeatureCan = featureCan(Features.Branches);
const isProjectFeatureCan = featureCan(Features.Projects);
// Load the accounts list.
const { data: accounts, isLoading: isAccountsLoading } = useAccounts();
@@ -60,7 +61,7 @@ function MakeJournalProvider({ journalId, query, ...props }) {
const {
data: { projects },
isLoading: isProjectsLoading,
} = useProjects();
} = useProjects({}, { enabled: !!isProjectFeatureCan });
// Submit form payload.
const [submitPayload, setSubmitPayload] = useState({});