@@ -3,9 +3,7 @@ import { FileChangeset, FileChange } from "@roo-code/types"
33import { useTranslation } from "react-i18next"
44import { useExtensionState } from "@/context/ExtensionStateContext"
55import { vscode } from "@/utils/vscode"
6-
7- // eslint-disable-next-line @typescript-eslint/no-empty-object-type
8- interface FilesChangedOverviewProps { }
6+ import { useDebouncedAction } from "@/components/ui/hooks/useDebouncedAction"
97
108interface _CheckpointEventData {
119 type : "checkpoint_created" | "checkpoint_restored"
@@ -18,7 +16,7 @@ interface _CheckpointEventData {
1816 * and displays file changes. It manages its own state and communicates with the backend
1917 * through VS Code message passing.
2018 */
21- const FilesChangedOverview : React . FC < FilesChangedOverviewProps > = ( ) => {
19+ const FilesChangedOverview : React . FC = ( ) => {
2220 const { t } = useTranslation ( )
2321 const { filesChangedEnabled } = useExtensionState ( )
2422
@@ -52,24 +50,13 @@ const FilesChangedOverview: React.FC<FilesChangedOverviewProps> = () => {
5250 const totalHeight = shouldVirtualize ? files . length * ITEM_HEIGHT : "auto"
5351 const offsetY = shouldVirtualize ? Math . floor ( scrollTop / ITEM_HEIGHT ) * ITEM_HEIGHT : 0
5452
55- // Simple double-click prevention
56- const [ isProcessing , setIsProcessing ] = React . useState ( false )
57- const timeoutRef = React . useRef < NodeJS . Timeout | null > ( null )
58-
59- // Cleanup timeout on unmount
60- React . useEffect ( ( ) => {
61- return ( ) => {
62- if ( timeoutRef . current ) {
63- clearTimeout ( timeoutRef . current )
64- }
65- }
66- } , [ ] )
53+ // Debounced click handling for double-click prevention
54+ const { isProcessing, handleWithDebounce } = useDebouncedAction ( 300 )
6755
6856 // FCO initialization logic
6957 const checkInit = React . useCallback (
70- ( baseCheckpoint : string ) => {
58+ ( _baseCheckpoint : string ) => {
7159 if ( ! isInitialized ) {
72- console . log ( "[FCO] Initializing with base checkpoint:" , baseCheckpoint )
7360 setIsInitialized ( true )
7461 }
7562 } ,
@@ -94,9 +81,7 @@ const FilesChangedOverview: React.FC<FilesChangedOverviewProps> = () => {
9481 )
9582
9683 // Handle checkpoint restoration with the 4 examples logic
97- const handleCheckpointRestored = React . useCallback ( ( restoredCheckpoint : string ) => {
98- console . log ( "[FCO] Handling checkpoint restore to:" , restoredCheckpoint )
99-
84+ const handleCheckpointRestored = React . useCallback ( ( _restoredCheckpoint : string ) => {
10085 // Request file changes after checkpoint restore
10186 // Backend should calculate changes from initial baseline to restored checkpoint
10287 vscode . postMessage ( { type : "filesChangedRequest" } )
@@ -128,25 +113,6 @@ const FilesChangedOverview: React.FC<FilesChangedOverviewProps> = () => {
128113 // Backend will send updated filesChanged message with filtered results
129114 } , [ files ] )
130115
131- const handleWithDebounce = React . useCallback (
132- async ( operation : ( ) => void ) => {
133- if ( isProcessing ) return
134- setIsProcessing ( true )
135- try {
136- operation ( )
137- } catch ( _error ) {
138- // Silently handle any errors to prevent crashing
139- // Debug logging removed for production
140- }
141- // Brief delay to prevent double-clicks
142- if ( timeoutRef . current ) {
143- clearTimeout ( timeoutRef . current )
144- }
145- timeoutRef . current = setTimeout ( ( ) => setIsProcessing ( false ) , 300 )
146- } ,
147- [ isProcessing ] ,
148- )
149-
150116 /**
151117 * Handles scroll events for virtualization
152118 * Updates scrollTop state to calculate visible items
@@ -167,14 +133,12 @@ const FilesChangedOverview: React.FC<FilesChangedOverviewProps> = () => {
167133
168134 // Guard against null/undefined/malformed messages
169135 if ( ! message || typeof message !== "object" || ! message . type ) {
170- console . debug ( "[FCO] Ignoring malformed message:" , message )
171136 return
172137 }
173138
174139 switch ( message . type ) {
175140 case "filesChanged" :
176141 if ( message . filesChanged ) {
177- console . log ( "[FCO] Received filesChanged message:" , message . filesChanged )
178142 checkInit ( message . filesChanged . baseCheckpoint )
179143 updateChangeset ( message . filesChanged )
180144 } else {
@@ -183,11 +147,9 @@ const FilesChangedOverview: React.FC<FilesChangedOverviewProps> = () => {
183147 }
184148 break
185149 case "checkpoint_created" :
186- console . log ( "[FCO] Checkpoint created:" , message . checkpoint )
187150 handleCheckpointCreated ( message . checkpoint , message . previousCheckpoint )
188151 break
189152 case "checkpoint_restored" :
190- console . log ( "[FCO] Checkpoint restored:" , message . checkpoint )
191153 handleCheckpointRestored ( message . checkpoint )
192154 break
193155 }
0 commit comments