فهرست منبع

Refactor hook

Shun Miyazawa 1 سال پیش
والد
کامیت
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;