diff --git a/app/client/src/pages/Editor/gitSync/components/BranchList.tsx b/app/client/src/pages/Editor/gitSync/components/BranchList.tsx index cafdd034e3..516e3d6931 100644 --- a/app/client/src/pages/Editor/gitSync/components/BranchList.tsx +++ b/app/client/src/pages/Editor/gitSync/components/BranchList.tsx @@ -6,7 +6,7 @@ import { useDispatch, useSelector } from "react-redux"; import { createNewBranchInit, fetchBranchesInit, - // setIsGitSyncModalOpen, + fetchGitProtectedBranchesInit, switchGitBranchInit, } from "actions/gitSyncActions"; import { @@ -15,6 +15,7 @@ import { getFetchingBranches, getGitBranches, getGitBranchNames, + getIsGetProtectedBranchesLoading, getProtectedBranchesSelector, } from "selectors/gitSyncSelectors"; @@ -54,7 +55,6 @@ import { RemoteBranchList } from "./RemoteBranchList"; import { LocalBranchList } from "./LocalBranchList"; import type { Theme } from "constants/DefaultTheme"; import { Space } from "./StyledComponents"; -// import { GitSyncModalTab } from "entities/GitSync"; const ListContainer = styled.div` flex: 1; @@ -69,11 +69,6 @@ const BranchDropdownContainer = styled.div` display: flex; flex-direction: column; - // & .title { - // ${getTypographyByKey("h3")}; - // color: var(--ads-v2-color-fg-emphasis-plus); - // } - padding: ${(props) => props.theme.spaces[5]}px; min-height: 0; `; @@ -246,6 +241,7 @@ export default function BranchList(props: { source: "BRANCH_LIST_POPUP_FROM_BOTTOM_BAR", }); dispatch(fetchBranchesInit({ pruneBranches: true })); + dispatch(fetchGitProtectedBranchesInit()); }; const branches = useSelector(getGitBranches); @@ -254,6 +250,9 @@ export default function BranchList(props: { const fetchingBranches = useSelector(getFetchingBranches); const defaultBranch = useSelector(getDefaultGitBranchName); const protectedBranches = useSelector(getProtectedBranchesSelector); + const isGetProtectedBranchesLoading = useSelector( + getIsGetProtectedBranchesLoading, + ); const [searchText, changeSearchTextInState] = useState(""); const changeSearchText = (text: string) => { changeSearchTextInState(removeSpecialChars(text)); @@ -340,6 +339,9 @@ export default function BranchList(props: { switchBranch, protectedBranches, ); + + const loading = fetchingBranches || isGetProtectedBranchesLoading; + return (
- {fetchingBranches && ( + {loading && (
)} - {!fetchingBranches && ( + {!loading && ( - {fetchingBranches && } - {!fetchingBranches && ( + {loading && } + {!loading && ( {/* keeping it commented for future use */} {/* { state.ui.gitSync.protectedBranchesLoading ); }; + +export const getIsGetProtectedBranchesLoading = (state: AppState) => { + return state.ui.gitSync.protectedBranchesLoading; +};