feat(branches): fix branches provider.

This commit is contained in:
elforjani13
2022-03-10 17:42:31 +02:00
parent c1ad349f6b
commit a75451cee7
2 changed files with 7 additions and 12 deletions

View File

@@ -11,7 +11,7 @@ const BranchesContext = React.createContext();
/**
* Branches data provider.
*/
function BranchesProvider({ ...props }) {
function BranchesProvider({ query, ...props }) {
// Features guard.
const { featureCan } = useFeatureCan();
@@ -22,10 +22,11 @@ function BranchesProvider({ ...props }) {
isLoading: isBranchesLoading,
isFetching: isBranchesFetching,
data: branches,
} = useBranches({}, { enabled: isBranchFeatureCan });
} = useBranches(query, { enabled: isBranchFeatureCan });
// Detarmines the datatable empty status.
const isEmptyStatus = isEmpty(branches) || !isBranchFeatureCan;
const isEmptyStatus =
(isEmpty(branches) && !isBranchesLoading) || !isBranchFeatureCan;
// Provider state.
const provider = {