Shun Miyazawa 11 месяцев назад
Родитель
Сommit
1031f5ceff
1 измененных файлов с 1 добавлено и 2 удалено
  1. 1 2
      apps/app/src/features/openai/client/services/editor-assistant.ts

+ 1 - 2
apps/app/src/features/openai/client/services/editor-assistant.ts

@@ -156,8 +156,6 @@ export const useEditorAssistant: UseEditorAssistant = () => {
       }),
     });
 
-    setSelectedText(undefined);
-
     return response;
   }, [selectedText]);
 
@@ -268,6 +266,7 @@ export const useEditorAssistant: UseEditorAssistant = () => {
 
       // Set detectedDiff to undefined after applying all detectedDiff to secondaryDoc
       if (detectedDiff?.filter(detectedDiff => detectedDiff.applied === false).length === 0) {
+        setSelectedText(undefined);
         setDetectedDiff(undefined);
         lineRef.current = 0;
         // positionRef.current = 0;