From ec17fbf1ce79bdc11e4f8061aa2a6cb0c9dbe682 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Mon, 17 Nov 2025 15:55:18 +0000 Subject: [PATCH] fix: refresh UI after checkpoint restore operation - Added postStateToWebview() call after checkpoint deletion/restoration - This ensures the webview displays the restored messages correctly - Fixes issue where chat history disappeared visually after restore - Updated tests to include the mock for postStateToWebview Fixes #9307 --- src/core/webview/__tests__/checkpointRestoreHandler.spec.ts | 1 + src/core/webview/checkpointRestoreHandler.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/core/webview/__tests__/checkpointRestoreHandler.spec.ts b/src/core/webview/__tests__/checkpointRestoreHandler.spec.ts index 98773feb6c..03bf277015 100644 --- a/src/core/webview/__tests__/checkpointRestoreHandler.spec.ts +++ b/src/core/webview/__tests__/checkpointRestoreHandler.spec.ts @@ -48,6 +48,7 @@ describe("checkpointRestoreHandler", () => { mockProvider = { getCurrentTask: vi.fn(() => mockCline), postMessageToWebview: vi.fn(), + postStateToWebview: vi.fn(), // Add this method to the mock getTaskWithId: vi.fn(() => ({ historyItem: { id: "test-task-123", messages: mockCline.clineMessages }, })), diff --git a/src/core/webview/checkpointRestoreHandler.ts b/src/core/webview/checkpointRestoreHandler.ts index a3f62f74f3..97360b170c 100644 --- a/src/core/webview/checkpointRestoreHandler.ts +++ b/src/core/webview/checkpointRestoreHandler.ts @@ -75,6 +75,9 @@ export async function handleCheckpointRestoreOperation(config: CheckpointRestore // Get the updated history item and reinitialize const { historyItem } = await provider.getTaskWithId(currentCline.taskId) await provider.createTaskWithHistoryItem(historyItem) + + // Update the webview to show the restored messages + await provider.postStateToWebview() } // For edit operations, the task cancellation in checkpointRestore // will trigger reinitialization, which will process pendingEditAfterRestore