fix: prevent chat UI flickering during cancel operations and checkpoint restoration (#8677) #8678
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the UI flickering issue that occurs when users cancel API responses or restore checkpoints. The flickering was caused by full task recreation triggering complete state refreshes in the React UI.
Problem
When users pressed "Cancel" during an API response or restored a checkpoint, the entire task was recreated from scratch, causing the UI to flicker and sometimes reload completely. This led to:
Solution
Implemented a "soft reload" mechanism that preserves UI state during these operations:
Changes
isSoftReloadingflag to ClineProvider with proper JSDoc documentationSTATE_UPDATE_DEBOUNCE_MSconstant for maintainabilitypostStateToWebview()methodcancelTask()to use soft reload mechanismisSoftReloadproperty to ExtensionMessage interfaceTesting
Fixes #8677
Important
Implements a soft reload mechanism to prevent UI flickering during cancel operations and checkpoint restoration in the chat UI.
ClineProvider.tsto prevent UI flickering during cancel operations and checkpoint restoration.isSoftReloadingflag toClineProviderto track soft reload state.postStateToWebview()to prevent rapid consecutive updates.cancelTask()and checkpoint restoration to use the soft reload mechanism.ChatView.tsxto check forisSoftReloadflag and preserve UI state.ClineProvider.spec.tsandcheckpointRestoreHandler.spec.ts.STATE_UPDATE_DEBOUNCE_MSconstant for maintainability.isSoftReloadproperty toExtensionMessageinterface.This description was created by
for 42385ae. You can customize this summary. It will automatically update as commits are pushed.