From b9110dc2435a05c5b456acfde480c6343c910f42 Mon Sep 17 00:00:00 2001 From: Daniel <57051444+daniel-lxs@users.noreply.github.com> Date: Thu, 23 Oct 2025 09:30:39 -0500 Subject: [PATCH] fix: always show checkpoint restore options regardless of change detection (#8758) --- .../chat/checkpoints/CheckpointMenu.tsx | 106 ++++++++---------- .../chat/checkpoints/CheckpointSaved.tsx | 4 +- 2 files changed, 46 insertions(+), 64 deletions(-) diff --git a/webview-ui/src/components/chat/checkpoints/CheckpointMenu.tsx b/webview-ui/src/components/chat/checkpoints/CheckpointMenu.tsx index d2fb860668..c6948e5ce3 100644 --- a/webview-ui/src/components/chat/checkpoints/CheckpointMenu.tsx +++ b/webview-ui/src/components/chat/checkpoints/CheckpointMenu.tsx @@ -11,7 +11,6 @@ import { Checkpoint } from "./schema" type CheckpointMenuBaseProps = { ts: number commitHash: string - currentHash?: string checkpoint: Checkpoint } type CheckpointMenuControlledProps = { @@ -24,21 +23,12 @@ type CheckpointMenuUncontrolledProps = { } type CheckpointMenuProps = CheckpointMenuBaseProps & (CheckpointMenuControlledProps | CheckpointMenuUncontrolledProps) -export const CheckpointMenu = ({ - ts, - commitHash, - currentHash, - checkpoint, - open, - onOpenChange, -}: CheckpointMenuProps) => { +export const CheckpointMenu = ({ ts, commitHash, checkpoint, open, onOpenChange }: CheckpointMenuProps) => { const { t } = useTranslation() const [internalOpen, setInternalOpen] = useState(false) const [isConfirming, setIsConfirming] = useState(false) const portalContainer = useRooPortal("roo-portal") - const isCurrent = currentHash === commitHash - const previousCommitHash = checkpoint?.from const isOpen = open ?? internalOpen @@ -88,60 +78,52 @@ export const CheckpointMenu = ({
- {!isCurrent && ( -
- +
+ {t("chat:checkpoint.menu.restoreFilesDescription")} +
+
+
+ {!isConfirming ? ( + + ) : ( + <> + + + + )} + {isConfirming ? ( +
+ {t("chat:checkpoint.menu.cannotUndo")} +
+ ) : (
- {t("chat:checkpoint.menu.restoreFilesDescription")} + {t("chat:checkpoint.menu.restoreFilesAndTaskDescription")}
-
- )} - {!isCurrent && ( -
-
- {!isConfirming ? ( - - ) : ( - <> - - - - )} - {isConfirming ? ( -
- {t("chat:checkpoint.menu.cannotUndo")} -
- ) : ( -
- {t("chat:checkpoint.menu.restoreFilesAndTaskDescription")} -
- )} -
-
- )} + )} +
diff --git a/webview-ui/src/components/chat/checkpoints/CheckpointSaved.tsx b/webview-ui/src/components/chat/checkpoints/CheckpointSaved.tsx index da16904e4c..710c2b3287 100644 --- a/webview-ui/src/components/chat/checkpoints/CheckpointSaved.tsx +++ b/webview-ui/src/components/chat/checkpoints/CheckpointSaved.tsx @@ -13,9 +13,9 @@ type CheckpointSavedProps = { checkpoint?: Record } -export const CheckpointSaved = ({ checkpoint, ...props }: CheckpointSavedProps) => { +export const CheckpointSaved = ({ checkpoint, currentHash, ...props }: CheckpointSavedProps) => { const { t } = useTranslation() - const isCurrent = props.currentHash === props.commitHash + const isCurrent = currentHash === props.commitHash const [isPopoverOpen, setIsPopoverOpen] = useState(false) const [isClosing, setIsClosing] = useState(false) const closeTimer = useRef(null)