diff --git a/app/components/Editor.tsx b/app/components/Editor.tsx index 1e2e7c0753..6df4c8ce88 100644 --- a/app/components/Editor.tsx +++ b/app/components/Editor.tsx @@ -7,7 +7,7 @@ import { mergeRefs } from "react-merge-refs"; import type { Optional } from "utility-types"; import EditorContainer from "@shared/editor/components/Styles"; import { AttachmentPreset } from "@shared/types"; -import { ProsemirrorHelper } from "@shared/utils/ProsemirrorHelper"; +import { ProsemirrorHelper } from "~/models/helpers/ProsemirrorHelper"; import AsyncEditor from "~/components/AsyncEditor"; import ClickablePadding from "~/components/ClickablePadding"; import ErrorBoundary from "~/components/ErrorBoundary"; @@ -200,9 +200,12 @@ function Editor({ ref, ...props }: Props & { ref?: React.Ref }) { [updateComments] ); - const paragraphs = React.useMemo(() => { + // Read-only content that needs no node views or plugins is rendered from + // the schema alone, avoiding an editor view per instance. + const staticHTML = React.useMemo(() => { if (props.readOnly && typeof props.value === "object") { - return ProsemirrorHelper.getPlainParagraphs(props.value); + const node = ProsemirrorHelper.toStaticNode(props.value); + return node ? ProsemirrorHelper.toHTML(node) : undefined; } return undefined; }, [props.readOnly, props.value]); @@ -210,22 +213,21 @@ function Editor({ ref, ...props }: Props & { ref?: React.Ref }) { return ( <> - {paragraphs ? ( + {staticHTML !== undefined ? ( -
- {paragraphs.map((paragraph, index) => ( -

- {paragraph.content?.map((content) => content.text)} -

- ))} -
+
) : ( // The boundary must live between the lazy editor and any ancestor diff --git a/app/components/Notifications/NotificationListItem.tsx b/app/components/Notifications/NotificationListItem.tsx index 104d69a9c8..657a224843 100644 --- a/app/components/Notifications/NotificationListItem.tsx +++ b/app/components/Notifications/NotificationListItem.tsx @@ -64,6 +64,10 @@ function NotificationListItem({ notification, onNavigate }: Props) { [notification] ); const menuAction = useMenuAction(actions); + const commentData = React.useMemo( + () => toJS(notification.comment?.data), + [notification.comment?.data] + ); return ( @@ -82,10 +86,8 @@ function NotificationListItem({ notification, onNavigate }: Props) {