diff --git a/libs/remix-ui/git/src/components/buttons/sourcecontrolbuttons.tsx b/libs/remix-ui/git/src/components/buttons/sourcecontrolbuttons.tsx
index 9dacb4beb6..5a3b092274 100644
--- a/libs/remix-ui/git/src/components/buttons/sourcecontrolbuttons.tsx
+++ b/libs/remix-ui/git/src/components/buttons/sourcecontrolbuttons.tsx
@@ -23,25 +23,33 @@ export const SourceControlButtons = (props: SourceControlButtonsProps) => {
useEffect(() => {
- console.log('BRANCH DIFF SourceControlButtons', context.branchDifferences, remote, branch)
+ console.log('BRANCH DIFF SourceControlButtons',branch, remote, context.branchDifferences, context.currentBranch)
setDefaultRemote()
if (remote && branch && context.branchDifferences && context.branchDifferences[`${remote.remote}/${branch.name}`]) {
+ console.log('BRANCH DIFF found SourceControlButtons', context.branchDifferences[`${remote.remote}/${branch.name}`])
setCommitsAhead(context.branchDifferences[`${remote.remote}/${branch.name}`]?.uniqueHeadCommits)
setCommitsBehind(context.branchDifferences[`${remote.remote}/${branch.name}`]?.uniqueRemoteCommits)
+ }else{
+ setCommitsAhead([])
+ setCommitsBehind([])
}
- }, [context.branchDifferences, branch, remote])
+ }, [context.branchDifferences, context.currentBranch, branch, remote])
const setDefaultRemote = () => {
+
if (context.remotes.length > 0) {
// find remote called origin
const origin = context.remotes.find(remote => remote.remote === 'origin')
+ console.log('DEFAULT REMOTE', origin)
if (origin) {
setRemote(origin)
} else {
setRemote(context.remotes[0])
}
+ return origin
}
+ return null
}
useEffect(() => {
diff --git a/libs/remix-ui/git/src/components/navigation/sourcecontrol.tsx b/libs/remix-ui/git/src/components/navigation/sourcecontrol.tsx
index 66b50f68e8..b8fe58041e 100644
--- a/libs/remix-ui/git/src/components/navigation/sourcecontrol.tsx
+++ b/libs/remix-ui/git/src/components/navigation/sourcecontrol.tsx
@@ -5,12 +5,13 @@ import React, { useContext, useEffect } from "react";
import { FormattedMessage } from "react-intl";
import { pluginActionsContext } from "../../state/context";
import { SourceControlButtons } from "../buttons/sourcecontrolbuttons";
+import { gitPluginContext } from "../gitui";
import LoaderIndicator from "./loaderindicator";
import { SourceControlMenu } from "./menu/sourcecontrolmenu";
export const SourceControlNavigation = ({ eventKey, activePanel, callback }) => {
const pluginactions = React.useContext(pluginActionsContext)
-
+ const context = React.useContext(gitPluginContext)
const handleClick = () => {
if (!callback) return
if (activePanel === eventKey) {
@@ -32,7 +33,7 @@ export const SourceControlNavigation = ({ eventKey, activePanel, callback }) =>
-
+
diff --git a/libs/remix-ui/git/src/components/panels/commands/pushpull.tsx b/libs/remix-ui/git/src/components/panels/commands/pushpull.tsx
index 4522c4a978..9aa765c642 100644
--- a/libs/remix-ui/git/src/components/panels/commands/pushpull.tsx
+++ b/libs/remix-ui/git/src/components/panels/commands/pushpull.tsx
@@ -20,7 +20,6 @@ export const PushPull = () => {
setRemoteBranch(context.currentBranch.name)
setLocalBranch(context.currentBranch.name)
if ((!context.upstream) && context.currentBranch && context.currentBranch.remote && context.currentBranch.remote.remote) {
- console.log('SET UPSTREAM', context.currentBranch.remote)
actions.setUpstreamRemote(context.currentBranch.remote)
}
}, [context.currentBranch])
@@ -32,22 +31,16 @@ export const PushPull = () => {
}
const onLocalBranchChange = (value: any) => {
- console.log('onLocalBranchChange', value)
setLocalBranch(value)
}
const onRemoteChange = (value: string) => {
- console.log('onRemoteChange', value, context)
const remote: remote = context.remotes.find(r => r.remote === value)
if(remote) {
actions.setUpstreamRemote(remote)
}
}
- useEffect(() => {
- console.log('UPSTREAM', context.upstream, context)
- }, [context.upstream])
-
const onForceChange = (event: any) => {
const target = event.target;
const value = target.checked;