diff --git a/apps/staged/src-tauri/src/timeline.rs b/apps/staged/src-tauri/src/timeline.rs index ac3dbe32c..a0326c784 100644 --- a/apps/staged/src-tauri/src/timeline.rs +++ b/apps/staged/src-tauri/src/timeline.rs @@ -83,8 +83,14 @@ fn build_branch_timeline(store: &Arc, branch_id: &str) -> Result commits, + Err(e) => { + log::warn!("Failed to get commits since base for branch {branch_id}: {e:?}"); + vec![] + } + }; // For each git commit, look up our metadata (session linkage) for gc in git_commits { diff --git a/apps/staged/src/lib/features/branches/BranchCard.svelte b/apps/staged/src/lib/features/branches/BranchCard.svelte index d3c5dc81e..33fb490ab 100644 --- a/apps/staged/src/lib/features/branches/BranchCard.svelte +++ b/apps/staged/src/lib/features/branches/BranchCard.svelte @@ -127,6 +127,11 @@ (isRemote && remoteWorkspaceStatus === 'starting') ); + /** True during provisioning OR the gap between worktree-ready and timeline-loaded. */ + let isSettingUp = $derived( + isProvisioning || (isLocal && !!branch.worktreePath && !timeline && !error) + ); + /** Empty timeline used during provisioning so the action buttons render. */ const emptyTimeline: BranchTimelineData = { commits: [], notes: [], reviews: [], images: [] }; @@ -171,22 +176,23 @@ /** Label for the provisioning timeline row, if applicable. */ let provisioningLabel = $derived.by(() => { - if (isLocal && !branch.worktreePath && !worktreeError) { - if (setupPhase) { - const labels: Record = { - cloning: 'Cloning repository…', - fetching: 'Fetching latest changes…', - creating_worktree: 'Creating worktree…', - running_setup_actions: 'Running setup actions…', - }; - return labels[setupPhase] ?? 'Setting up…'; + if (!isSettingUp) return undefined; + if (isProvisioning) { + if (isLocal) { + if (setupPhase) { + const labels: Record = { + cloning: 'Cloning repository…', + fetching: 'Fetching latest changes…', + creating_worktree: 'Creating worktree…', + running_setup_actions: 'Running setup actions…', + }; + return labels[setupPhase] ?? 'Setting up…'; + } + return 'Setting up…'; } - return 'Setting up…'; - } - if (isRemote && remoteWorkspaceStatus === 'starting') { return 'Starting workspace…'; } - return undefined; + return 'Looking for changes…'; }); /** Map blox orchestrator CommandType enum names to display labels. */ @@ -199,15 +205,14 @@ /** Detail text for the provisioning row (e.g. git progress percentages or step info). */ let provisioningDetail = $derived.by(() => { - if (isLocal && !branch.worktreePath && !worktreeError) return setupDetail; - if (isRemote && remoteWorkspaceStatus === 'starting') { - if (setupDetail && setupPhase) { - const label = remoteCommandLabels[setupPhase] ?? setupPhase; - return `${setupDetail} · ${label}`; - } - return setupDetail; + if (!isProvisioning) return null; + if (isLocal) return setupDetail; + // Remote workspace starting + if (setupDetail && setupPhase) { + const label = remoteCommandLabels[setupPhase] ?? setupPhase; + return `${setupDetail} · ${label}`; } - return null; + return setupDetail; }); /** True when the branch has at least one finalized commit (code changes vs base). */ @@ -446,6 +451,7 @@ return; } + commands.invalidateBranchTimeline(branch.id); loadTimeline(); // Handle PR session completion if (prButton && eventSessionId === prButton.getPrSessionId()) { @@ -948,7 +954,7 @@ {repoLabel} {isLocal} {isRemote} - {isProvisioning} + {isSettingUp} {remoteWorkspaceStatus} {onDelete} {onRename} @@ -971,7 +977,7 @@ {workspaceError} fallbackError={error} /> - {:else if loading && !isProvisioning} + {:else if loading && !isSettingUp}
Loading... @@ -981,7 +987,7 @@ {error}
- {:else if timeline || isProvisioning} + {:else if timeline || isSettingUp} void; onRename?: (branchName: string) => void; @@ -77,7 +77,7 @@ repoLabel = null, isLocal, isRemote, - isProvisioning, + isSettingUp, remoteWorkspaceStatus, onDelete, onRename, @@ -617,7 +617,7 @@ {/each} - {#if !isProvisioning && primaryRunAction} + {#if !isSettingUp && primaryRunAction} {@const execution = primaryActionExecution} {@const isRunning = execution?.status === 'running'} {@const isStopping = execution && stoppingExecutions.has(execution.executionId)} @@ -755,7 +755,7 @@ {#if showMoreMenu}
- {#if !isProvisioning} + {#if !isSettingUp} {#if isRemote && branch.workspaceName}