From b515c0ffa66f27994c6ffc627bb37da2e12d6510 Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Mon, 11 Dec 2023 17:27:52 +0530 Subject: [PATCH] fix: issue with GPT assistant response not updating on new requests. (#3063) --- web/components/core/modals/gpt-assistant-modal.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/components/core/modals/gpt-assistant-modal.tsx b/web/components/core/modals/gpt-assistant-modal.tsx index 98fd37904..10df4d8f8 100644 --- a/web/components/core/modals/gpt-assistant-modal.tsx +++ b/web/components/core/modals/gpt-assistant-modal.tsx @@ -9,7 +9,7 @@ import useToast from "hooks/use-toast"; // ui import { Button, Input } from "@plane/ui"; // components -import { RichReadOnlyEditor, RichReadOnlyEditorWithRef } from "@plane/rich-text-editor"; +import { RichReadOnlyEditorWithRef } from "@plane/rich-text-editor"; // types import { IIssue, IPageBlock } from "types"; @@ -42,6 +42,7 @@ export const GptAssistantModal: React.FC = (props) => { const { workspaceSlug } = router.query; const editorRef = useRef(null); + const responseRef = useRef(null); const { setToastAlert } = useToast(); @@ -115,6 +116,10 @@ export const GptAssistantModal: React.FC = (props) => { editorRef.current?.setEditorValue(htmlContent ?? `

${content}

`); }, [htmlContent, editorRef, content]); + useEffect(() => { + responseRef.current?.setEditorValue(`

${response}

`); + }, [response, responseRef]); + return (
= (props) => { {response !== "" && (
Response: - ${response}

`} customClassName="-mx-3 -my-3" noBorder borderOnFocus={false} + ref={responseRef} />
)}