From e0a4a3879638ad0ba8b69238c4c66476ad703c4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Salavisa?= Date: Fri, 22 May 2026 12:29:38 +0100 Subject: [PATCH] fix(vcs): default the commit dialog's stage-all checkbox to unchecked (#1010) fix(vcs): default the commit dialog's "stage all" checkbox to unchecked Opening a commit dialog now commits only already-staged files by default. Users can opt in to "Stage all changes before committing" per commit. Co-authored-by: Kandev Agent --- .../session-mobile-top-bar-git-controls.tsx | 4 ++-- apps/web/components/vcs/vcs-dialogs.tsx | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/web/components/task/mobile/session-mobile-top-bar-git-controls.tsx b/apps/web/components/task/mobile/session-mobile-top-bar-git-controls.tsx index 1b94059581..b9290fdabe 100644 --- a/apps/web/components/task/mobile/session-mobile-top-bar-git-controls.tsx +++ b/apps/web/components/task/mobile/session-mobile-top-bar-git-controls.tsx @@ -98,13 +98,13 @@ function useCommitDialogForm( ) { const [commitMessage, setCommitMessage] = useState(""); const [commitBody, setCommitBody] = useState(""); - const [stageAll, setStageAll] = useState(true); + const [stageAll, setStageAll] = useState(false); const handleOpen = (isOpen: boolean) => { if (isOpen) { setCommitMessage(""); setCommitBody(""); - setStageAll(true); + setStageAll(false); } onOpenChange(isOpen); }; diff --git a/apps/web/components/vcs/vcs-dialogs.tsx b/apps/web/components/vcs/vcs-dialogs.tsx index df12ca729a..2944bac96e 100644 --- a/apps/web/components/vcs/vcs-dialogs.tsx +++ b/apps/web/components/vcs/vcs-dialogs.tsx @@ -61,15 +61,15 @@ type FileSummary = { count: number; additions: number; deletions: number }; /** * Counts files for the commit dialog summary. - * - When `stageAll=true` (the default), include every file (staged + unstaged) - * because the commit op stages them all before committing. - * - When `stageAll=false`, count only staged files — those are the only files - * the commit will actually include. Counting all here would over-state what - * the commit produces and surprise the user post-commit. + * - When `stageAll=true`, include every file (staged + unstaged) because the + * commit op stages them all before committing. + * - When `stageAll=false` (the default), count only staged files — those are + * the only files the commit will actually include. Counting all here would + * over-state what the commit produces and surprise the user post-commit. */ function computeFileSummary( files: Record | undefined, - stageAll: boolean = true, + stageAll: boolean = false, ): FileSummary { if (!files) return { count: 0, additions: 0, deletions: 0 }; const considered = (Object.values(files) as FileInfo[]).filter((f) => stageAll || f.staged); @@ -337,12 +337,12 @@ function useCommitDialogState(): UseCommitDialogReturn { const [open, setOpen] = useState(false); const [message, setMessage] = useState(""); const [body, setBody] = useState(""); - const [stageAll, setStageAll] = useState(true); + const [stageAll, setStageAll] = useState(false); const [repo, setRepo] = useState(""); const openDialog = useCallback((nextRepo?: string) => { setMessage(""); setBody(""); - setStageAll(true); + setStageAll(false); // Defensive: callers binding `openDialog` directly to onClick can leak the // React MouseEvent into nextRepo. Only accept actual repo strings. setRepo(typeof nextRepo === "string" ? nextRepo : "");