diff --git a/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx b/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx index 8219ccb608..d56e7e8a51 100644 --- a/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx +++ b/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx @@ -34,11 +34,11 @@ import { GitSyncModalTab } from "entities/GitSync"; import { getCountOfChangesToCommit, getGitStatus, + getIsDiscardInProgress, getIsFetchingGitStatus, getIsGitConnected, getIsPollingAutocommit, getPullFailed, - getPullInProgress, protectedModeSelector, } from "selectors/gitSyncSelectors"; import SpinnerLoader from "pages/common/SpinnerLoader"; @@ -188,18 +188,18 @@ const getQuickActionButtons = ({ return [ { className: "t--bottom-bar-commit", - disabled: isProtectedMode, + disabled: !isFetchingGitStatus && isProtectedMode, count: isProtectedMode ? undefined : changesToCommit, icon: "plus", loading: isFetchingGitStatus, - onClick: commit, + onClick: () => !isFetchingGitStatus && !isProtectedMode && commit(), tooltipText: createMessage(COMMIT_CHANGES), }, { className: "t--bottom-bar-pull", count: gitStatus?.behindCount, icon: "down-arrow-2", - onClick: () => !pullDisabled && pull(), + onClick: () => !showPullLoadingState && !pullDisabled && pull(), tooltipText: pullTooltipMessage, disabled: !showPullLoadingState && pullDisabled, loading: showPullLoadingState, @@ -329,7 +329,7 @@ export default function QuickGitActions() { const { disabled: pullDisabled, message: pullTooltipMessage } = getPullBtnStatus(gitStatus, !!pullFailed, isProtectedMode); - const isPullInProgress = useSelector(getPullInProgress); + const isPullInProgress = useSelector(getIsDiscardInProgress); const isFetchingGitStatus = useSelector(getIsFetchingGitStatus); const showPullLoadingState = isPullInProgress || isFetchingGitStatus; const changesToCommit = useSelector(getCountOfChangesToCommit); diff --git a/app/client/src/reducers/uiReducers/gitSyncReducer.ts b/app/client/src/reducers/uiReducers/gitSyncReducer.ts index 6c5d6e4bc8..d4a5d22f9d 100644 --- a/app/client/src/reducers/uiReducers/gitSyncReducer.ts +++ b/app/client/src/reducers/uiReducers/gitSyncReducer.ts @@ -29,6 +29,8 @@ const initialState: GitSyncReducerState = { fetchingBranches: false, localGitConfig: { authorEmail: "", authorName: "" }, + isDiscarding: false, + isFetchingLocalGitConfig: false, isFetchingGlobalGitConfig: false, @@ -542,6 +544,11 @@ const gitSyncReducer = createReducer(initialState, { ...state, deletingBranch: action.payload, }), + [ReduxActionTypes.GIT_DISCARD_CHANGES]: (state: GitSyncReducerState) => ({ + ...state, + isDiscarding: true, + discardError: null, + }), [ReduxActionTypes.GIT_DISCARD_CHANGES_SUCCESS]: ( state: GitSyncReducerState, action: ReduxAction, @@ -812,7 +819,7 @@ export type GitSyncReducerState = GitBranchDeleteState & { gitImportError?: any; - isDiscarding?: boolean; + isDiscarding: boolean; discard?: GitDiscardResponse; discardError?: GitErrorType;