Skip to content

Commit 2446dc0

Browse files
dominikzabcikclaude
andcommitted
fix(web): Edit from here offers file restore only in a worktree
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 5f69cac commit 2446dc0

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4036,6 +4036,7 @@ export default function ChatView(props: ChatViewProps) {
40364036
<RevertConfirmHost
40374037
threadKey={routeThreadKey}
40384038
checkpoints={serverProjection?.checkpoints}
4039+
isWorktree={activeWorktreePath !== null}
40394040
onConfirm={onConfirmRevertStable}
40404041
/>
40414042
{embedded ? null : <LinkPullRequestDialogHost />}

‎apps/web/src/components/chat/ChatOverlayHosts.tsx‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ export function openRevertConfirm(threadKey: string, pending: PendingRevert): vo
196196
export function RevertConfirmHost(props: {
197197
readonly threadKey: string;
198198
readonly checkpoints: OrchestrationV2ThreadProjection["checkpoints"] | undefined;
199+
// The server refuses file restore outside a thread's own worktree.
200+
readonly isWorktree: boolean;
199201
readonly onConfirm: (turnCount: number, messageId: MessageId, restoreFiles: boolean) => void;
200202
}) {
201203
const pending = useThreadOverlay(revertConfirmAtom, props.threadKey);
@@ -218,19 +220,23 @@ export function RevertConfirmHost(props: {
218220
<AlertDialogHeader>
219221
<AlertDialogTitle>Edit from here?</AlertDialogTitle>
220222
<AlertDialogDescription>
221-
Rewind chat to before this message. Your prompt and attachments return to the composer.
222-
“Revert files too” also undoes your own edits.
223+
Rewind chat to before this message. Your prompt and attachments return to the composer.{" "}
224+
{props.isWorktree
225+
? "“Revert files too” also undoes your own edits."
226+
: "Files stay as they are because this thread shares the project directory."}
223227
</AlertDialogDescription>
224228
</AlertDialogHeader>
225229
<AlertDialogFooter>
226230
<AlertDialogClose render={<Button variant="outline" />}>Cancel</AlertDialogClose>
227-
<Button
228-
variant="destructive-outline"
229-
disabled={!canRestoreFiles}
230-
onClick={() => confirm(true)}
231-
>
232-
Revert files too
233-
</Button>
231+
{props.isWorktree ? (
232+
<Button
233+
variant="destructive-outline"
234+
disabled={!canRestoreFiles}
235+
onClick={() => confirm(true)}
236+
>
237+
Revert files too
238+
</Button>
239+
) : null}
234240
<Button onClick={() => confirm(false)}>Revert and keep changes</Button>
235241
</AlertDialogFooter>
236242
</AlertDialogPopup>

0 commit comments

Comments
 (0)