diff --git a/gitbutler-ui/src/lib/components/Navigation.svelte b/gitbutler-ui/src/lib/components/Navigation.svelte index 7578d3f37..1fa0cb5b7 100644 --- a/gitbutler-ui/src/lib/components/Navigation.svelte +++ b/gitbutler-ui/src/lib/components/Navigation.svelte @@ -3,12 +3,11 @@ import DomainButton from './DomainButton.svelte'; import Footer from './Footer.svelte'; import ProjectSelector from './ProjectSelector.svelte'; + import UpdateBaseButton from './UpdateBaseButton.svelte'; import BaseBranchCard from '$lib/components/BaseBranchCard.svelte'; import Resizer from '$lib/components/Resizer.svelte'; - import Tag from '$lib/components/Tag.svelte'; import { persisted } from '$lib/persisted/persisted'; import { SETTINGS_CONTEXT, type SettingsStore } from '$lib/settings/userSettings'; - import * as toasts from '$lib/utils/toasts'; import { getContext } from 'svelte'; import type { User } from '$lib/backend/cloud'; import type { Project, ProjectService } from '$lib/backend/projects'; @@ -66,23 +65,7 @@ Workspace {#if ($base$?.behind || 0) > 0} - { - e.preventDefault(); - e.stopPropagation(); - try { - await branchController.updateBaseBranch(); - } catch { - toasts.error('Failed update working directory'); - } - }} - > - Update - + {/if} diff --git a/gitbutler-ui/src/lib/components/UpdateBaseButton.svelte b/gitbutler-ui/src/lib/components/UpdateBaseButton.svelte new file mode 100644 index 000000000..0d45f6267 --- /dev/null +++ b/gitbutler-ui/src/lib/components/UpdateBaseButton.svelte @@ -0,0 +1,32 @@ + + + { + loading = true; + try { + await branchController.updateBaseBranch(); + } catch { + toasts.error('Failed update workspace'); + } finally { + loading = false; + } + }} +> + {#if loading} + busy... + {:else} + Update + {/if} + diff --git a/gitbutler-ui/src/lib/vbranches/branchController.ts b/gitbutler-ui/src/lib/vbranches/branchController.ts index db5ec1ce8..38e5e3a75 100644 --- a/gitbutler-ui/src/lib/vbranches/branchController.ts +++ b/gitbutler-ui/src/lib/vbranches/branchController.ts @@ -200,8 +200,6 @@ export class BranchController { async updateBaseBranch() { try { await invoke('update_base_branch', { projectId: this.projectId }); - } catch (err) { - toasts.error('Failed to update target'); } finally { this.targetBranchService.reload(); }