Skip to content

Commit 29a02a8

Browse files
committed
fix: prevent live branch sync from clearing thread metadata on detached HEAD
When the repository enters detached HEAD state (e.g., during rebase, bisect, or manual commit checkout), gitStatus.branch becomes null. resolveLiveThreadBranchUpdate would return { branch: null }, causing persistThreadBranchSync to permanently clear the thread's branch metadata. Add a guard to skip syncing when gitStatus.branch is null, since detached HEAD is a transient state and the stored branch association should be preserved.
1 parent 6b7c570 commit 29a02a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apps/web/src/components/GitActionsControl.logic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ export function resolveLiveThreadBranchUpdate(input: {
316316
threadBranch: string | null;
317317
gitStatus: GitStatusResult | null;
318318
}): { branch: string | null } | null {
319-
if (!input.gitStatus) {
319+
if (!input.gitStatus || !input.gitStatus.branch) {
320320
return null;
321321
}
322322

0 commit comments

Comments
 (0)