diff --git a/surfsense_web/components/assistant-ui/inline-mention-editor.tsx b/surfsense_web/components/assistant-ui/inline-mention-editor.tsx index dacc845ec..e1f318de5 100644 --- a/surfsense_web/components/assistant-ui/inline-mention-editor.tsx +++ b/surfsense_web/components/assistant-ui/inline-mention-editor.tsx @@ -10,7 +10,8 @@ import { useRef, useState, } from "react"; -import ReactDOMServer from "react-dom/server"; +import { flushSync } from "react-dom"; +import { createRoot } from "react-dom/client"; import { getConnectorIcon } from "@/contracts/enums/connectorIcons"; import type { Document } from "@/contracts/types/document.types"; import { cn } from "@/lib/utils"; @@ -83,6 +84,12 @@ function getChipDocType(element: Element): string { return element.getAttribute(CHIP_DOCTYPE_ATTR) ?? "UNKNOWN"; } +function renderIconToElement(reactElement: React.ReactElement, container: HTMLElement): void { + flushSync(() => { + createRoot(container).render(reactElement); + }); +} + export const InlineMentionEditor = forwardRef( ( { @@ -186,8 +193,9 @@ export const InlineMentionEditor = forwardRef { e.preventDefault();