Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ describe("checkpointRestoreHandler", () => {
mockProvider = {
getCurrentTask: vi.fn(() => mockCline),
postMessageToWebview: vi.fn(),
postStateToWebview: vi.fn(), // Add this method to the mock
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While postStateToWebview is correctly added to the mock, the test "should save messages after delete operation" (line 149) doesn't verify this method is actually called. Since the implementation now calls await provider.postStateToWebview() after the checkpoint restore for delete operations, add an assertion like expect(mockProvider.postStateToWebview).toHaveBeenCalled() to ensure the UI refresh happens as intended.

Fix it with Roo Code or mention @roomote and request a fix.

getTaskWithId: vi.fn(() => ({
historyItem: { id: "test-task-123", messages: mockCline.clineMessages },
})),
Expand Down
3 changes: 3 additions & 0 deletions src/core/webview/checkpointRestoreHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading