From a75451cee7f2baf6f735e67d83e2d15c738c1eb0 Mon Sep 17 00:00:00 2001
From: elforjani13 <39470382+elforjani13@users.noreply.github.com>
Date: Thu, 10 Mar 2022 17:42:31 +0200
Subject: [PATCH] feat(branches): fix branches provider.
---
src/containers/Preferences/Branches/Branches.js | 12 +++---------
.../Preferences/Branches/BranchesProvider.js | 7 ++++---
2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/src/containers/Preferences/Branches/Branches.js b/src/containers/Preferences/Branches/Branches.js
index 281f6a4e7..0a71ff687 100644
--- a/src/containers/Preferences/Branches/Branches.js
+++ b/src/containers/Preferences/Branches/Branches.js
@@ -3,7 +3,6 @@ import intl from 'react-intl-universal';
import BranchesDataTable from './BranchesDataTable';
import BranchesEmptyStatus from './BranchesEmptyStatus';
-import { Choose } from 'components';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
import { useBranchesContext } from './BranchesProvider';
@@ -21,14 +20,9 @@ function Branches({
}, [changePreferencesPageTitle]);
return (
-
-
-
-
-
-
-
-
+
+ {isEmptyStatus ? : }
+
);
}
export default compose(withDashboardActions)(Branches);
diff --git a/src/containers/Preferences/Branches/BranchesProvider.js b/src/containers/Preferences/Branches/BranchesProvider.js
index 43256b0d9..98aa23569 100644
--- a/src/containers/Preferences/Branches/BranchesProvider.js
+++ b/src/containers/Preferences/Branches/BranchesProvider.js
@@ -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 = {