@@ -14,7 +14,6 @@ const logger = createLogger('DiffControls')
1414
1515export const DiffControls = memo ( function DiffControls ( ) {
1616 const isTerminalResizing = useTerminalStore ( ( state ) => state . isResizing )
17- // Optimized: Single diff store subscription
1817 const {
1918 isShowingDiff,
2019 isDiffReady,
@@ -38,12 +37,10 @@ export const DiffControls = memo(function DiffControls() {
3837 )
3938 )
4039
41- // Optimized: Single copilot store subscription for needed values
42- const { updatePreviewToolCallState, clearPreviewYaml, currentChat, messages } = useCopilotStore (
40+ const { updatePreviewToolCallState, currentChat, messages } = useCopilotStore (
4341 useCallback (
4442 ( state ) => ( {
4543 updatePreviewToolCallState : state . updatePreviewToolCallState ,
46- clearPreviewYaml : state . clearPreviewYaml ,
4744 currentChat : state . currentChat ,
4845 messages : state . messages ,
4946 } ) ,
@@ -222,11 +219,6 @@ export const DiffControls = memo(function DiffControls() {
222219 logger . warn ( 'Failed to create checkpoint before accept:' , error )
223220 } )
224221
225- // Clear preview YAML immediately
226- await clearPreviewYaml ( ) . catch ( ( error ) => {
227- logger . warn ( 'Failed to clear preview YAML:' , error )
228- } )
229-
230222 // Resolve target toolCallId for build/edit and update to terminal success state in the copilot store
231223 try {
232224 const { toolCallsById, messages } = useCopilotStore . getState ( )
@@ -266,16 +258,11 @@ export const DiffControls = memo(function DiffControls() {
266258 logger . error ( 'Workflow update failed:' , errorMessage )
267259 alert ( `Failed to save workflow changes: ${ errorMessage } ` )
268260 }
269- } , [ createCheckpoint , clearPreviewYaml , updatePreviewToolCallState , acceptChanges ] )
261+ } , [ createCheckpoint , updatePreviewToolCallState , acceptChanges ] )
270262
271263 const handleReject = useCallback ( ( ) => {
272264 logger . info ( 'Rejecting proposed changes (optimistic)' )
273265
274- // Clear preview YAML immediately
275- clearPreviewYaml ( ) . catch ( ( error ) => {
276- logger . warn ( 'Failed to clear preview YAML:' , error )
277- } )
278-
279266 // Resolve target toolCallId for build/edit and update to terminal rejected state in the copilot store
280267 try {
281268 const { toolCallsById, messages } = useCopilotStore . getState ( )
@@ -306,7 +293,7 @@ export const DiffControls = memo(function DiffControls() {
306293 rejectChanges ( ) . catch ( ( error ) => {
307294 logger . error ( 'Failed to reject changes (background):' , error )
308295 } )
309- } , [ clearPreviewYaml , updatePreviewToolCallState , rejectChanges ] )
296+ } , [ updatePreviewToolCallState , rejectChanges ] )
310297
311298 // Don't show anything if no diff is available or diff is not ready
312299 if ( ! hasActiveDiff || ! isDiffReady ) {
0 commit comments