Explorar el Código

Refactor hook

Shun Miyazawa hace 11 meses
padre
commit
1031f5ceff

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

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