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
This commit is contained in:
Roo Code 2025-11-17 15:55:18 +00:00
parent 3e0bd0ea55
commit ec17fbf1ce
2 changed files with 4 additions and 0 deletions

View file

@ -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 },
})),

View file

@ -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