Skip to content

Commit ffe7b0f

Browse files
committed
fix: always show checkpoint restore options regardless of change detection
Previously, checkpoint restore options were hidden when the system detected no changes (isCurrent === true). This caused the checkpoint menu popover to appear empty for current checkpoints. Changes: - Removed conditional rendering in CheckpointMenu.tsx that hid restore options for current checkpoints - Prefixed unused currentHash parameter with underscore to satisfy linter - Removed conditional rendering in App.tsx for CheckpointRestoreDialog - Always show 'Restore to Checkpoint' button in CheckpointRestoreDialog.tsx - Updated tests to reflect the new behavior All checkpoint restore options are now always visible, ensuring users can restore to any checkpoint even when change detection indicates no differences.
1 parent f3a505f commit ffe7b0f

File tree

1 file changed

+46
-52
lines changed

1 file changed

+46
-52
lines changed

webview-ui/src/components/chat/checkpoints/CheckpointMenu.tsx

Lines changed: 46 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type CheckpointMenuProps = CheckpointMenuBaseProps & (CheckpointMenuControlledPr
2727
export const CheckpointMenu = ({
2828
ts,
2929
commitHash,
30-
currentHash,
30+
currentHash: _currentHash,
3131
checkpoint,
3232
open,
3333
onOpenChange,
@@ -37,8 +37,6 @@ export const CheckpointMenu = ({
3737
const [isConfirming, setIsConfirming] = useState(false)
3838
const portalContainer = useRooPortal("roo-portal")
3939

40-
const isCurrent = currentHash === commitHash
41-
4240
const previousCommitHash = checkpoint?.from
4341

4442
const isOpen = open ?? internalOpen
@@ -88,60 +86,56 @@ export const CheckpointMenu = ({
8886
</StandardTooltip>
8987
<PopoverContent align="end" container={portalContainer}>
9088
<div className="flex flex-col gap-2">
91-
{!isCurrent && (
92-
<div className="flex flex-col gap-1 group hover:text-foreground">
93-
<Button variant="secondary" onClick={onPreview} data-testid="restore-files-btn">
94-
{t("chat:checkpoint.menu.restoreFiles")}
95-
</Button>
96-
<div className="text-muted transition-colors group-hover:text-foreground">
97-
{t("chat:checkpoint.menu.restoreFilesDescription")}
98-
</div>
89+
<div className="flex flex-col gap-1 group hover:text-foreground">
90+
<Button variant="secondary" onClick={onPreview} data-testid="restore-files-btn">
91+
{t("chat:checkpoint.menu.restoreFiles")}
92+
</Button>
93+
<div className="text-muted transition-colors group-hover:text-foreground">
94+
{t("chat:checkpoint.menu.restoreFilesDescription")}
9995
</div>
100-
)}
101-
{!isCurrent && (
96+
</div>
97+
<div className="flex flex-col gap-1 group hover:text-foreground">
10298
<div className="flex flex-col gap-1 group hover:text-foreground">
103-
<div className="flex flex-col gap-1 group hover:text-foreground">
104-
{!isConfirming ? (
99+
{!isConfirming ? (
100+
<Button
101+
variant="secondary"
102+
onClick={() => setIsConfirming(true)}
103+
data-testid="restore-files-and-task-btn">
104+
{t("chat:checkpoint.menu.restoreFilesAndTask")}
105+
</Button>
106+
) : (
107+
<>
105108
<Button
106-
variant="secondary"
107-
onClick={() => setIsConfirming(true)}
108-
data-testid="restore-files-and-task-btn">
109-
{t("chat:checkpoint.menu.restoreFilesAndTask")}
109+
variant="default"
110+
onClick={onRestore}
111+
className="grow"
112+
data-testid="confirm-restore-btn">
113+
<div className="flex flex-row gap-1">
114+
<CheckIcon />
115+
<div>{t("chat:checkpoint.menu.confirm")}</div>
116+
</div>
117+
</Button>
118+
<Button variant="secondary" onClick={() => setIsConfirming(false)}>
119+
<div className="flex flex-row gap-1">
120+
<Cross2Icon />
121+
<div>{t("chat:checkpoint.menu.cancel")}</div>
122+
</div>
110123
</Button>
111-
) : (
112-
<>
113-
<Button
114-
variant="default"
115-
onClick={onRestore}
116-
className="grow"
117-
data-testid="confirm-restore-btn">
118-
<div className="flex flex-row gap-1">
119-
<CheckIcon />
120-
<div>{t("chat:checkpoint.menu.confirm")}</div>
121-
</div>
122-
</Button>
123-
<Button variant="secondary" onClick={() => setIsConfirming(false)}>
124-
<div className="flex flex-row gap-1">
125-
<Cross2Icon />
126-
<div>{t("chat:checkpoint.menu.cancel")}</div>
127-
</div>
128-
</Button>
129-
</>
130-
)}
131-
{isConfirming ? (
132-
<div
133-
data-testid="checkpoint-confirm-warning"
134-
className="text-destructive font-bold">
135-
{t("chat:checkpoint.menu.cannotUndo")}
136-
</div>
137-
) : (
138-
<div className="text-muted transition-colors group-hover:text-foreground">
139-
{t("chat:checkpoint.menu.restoreFilesAndTaskDescription")}
140-
</div>
141-
)}
142-
</div>
124+
</>
125+
)}
126+
{isConfirming ? (
127+
<div
128+
data-testid="checkpoint-confirm-warning"
129+
className="text-destructive font-bold">
130+
{t("chat:checkpoint.menu.cannotUndo")}
131+
</div>
132+
) : (
133+
<div className="text-muted transition-colors group-hover:text-foreground">
134+
{t("chat:checkpoint.menu.restoreFilesAndTaskDescription")}
135+
</div>
136+
)}
143137
</div>
144-
)}
138+
</div>
145139
</div>
146140
</PopoverContent>
147141
</Popover>

0 commit comments

Comments
 (0)