Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(ai): point an open rewind confirmation at the stored message id

EtienneLescot405852bde4be
diff --git a/src/components/ai-edition/LeftPanel.tsx b/src/components/ai-edition/LeftPanel.tsx
index 4b534ed6d..144d0b4c7 100644
--- a/src/components/ai-edition/LeftPanel.tsx
+++ b/src/components/ai-edition/LeftPanel.tsx
@@ -636,6 +636,18 @@ export function ChatStripPanel() {
nativeBridgeClient.aiEdition.chatRun(projectId, sessionId, text, documentSnapshot),
);
setMessages((prev) => adoptStoredUserMessage(prev, optimisticUserId, result));
+ // A rewind confirmation opened during the turn names the message too. Stored without a
+ // checkpoint, the message has nothing to rewind to and the confirmation closes.
+ const storedId = result.userMessageId;
+ if (storedId) {
+ setRewindFor((open) =>
+ open?.messageId !== optimisticUserId
+ ? open
+ : result.userMessageCheckpointId
+ ? { ...open, messageId: storedId }
+ : null,
+ );
+ }
const assistant = result.assistantMessage;
if (result.success && assistant) {
if (result.document) {