From d9642eee8283de9c75ed86ee04a856b7895b954d Mon Sep 17 00:00:00 2001 From: Dakshesh Jain <65905942+dakshesh14@users.noreply.github.com> Date: Fri, 19 May 2023 20:33:35 +0530 Subject: [PATCH] fix: ai response not coming when using 'AI' button (#1091) * fix: ai response not comming for page * fix: ai response not coming when using 'AI' button --- apps/app/components/pages/create-update-block-inline.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/app/components/pages/create-update-block-inline.tsx b/apps/app/components/pages/create-update-block-inline.tsx index 336c04edd..528c83f9e 100644 --- a/apps/app/components/pages/create-update-block-inline.tsx +++ b/apps/app/components/pages/create-update-block-inline.tsx @@ -365,10 +365,15 @@ export const CreateUpdateBlockInline: React.FC = ({ content={watch("description_html")} htmlContent={watch("description_html")} onResponse={(response) => { - if (data && handleAiAssistance) handleAiAssistance(response); - else { + if (data && handleAiAssistance) { + handleAiAssistance(response); + editorRef.current?.setEditorValue( + `${watch("description_html")}

${response}

` ?? "" + ); + } else { setValue("description", {}); setValue("description_html", `${watch("description_html")}

${response}

`); + editorRef.current?.setEditorValue(watch("description_html") ?? ""); } }}