From 35c4d504a809b4bffa382d9ec71b5291d3aea05b Mon Sep 17 00:00:00 2001 From: Palanikannan M Date: Wed, 30 Jul 2025 21:49:15 +0530 Subject: [PATCH] fix: add unique keys to add nodeview wrappers --- packages/editor/src/core/extensions/callout/block.tsx | 6 +++++- .../src/core/extensions/code/code-block-node-view.tsx | 7 +++++-- .../core/extensions/custom-image/components/node-view.tsx | 4 ++-- .../src/core/extensions/mentions/mention-node-view.tsx | 5 ++++- .../src/core/extensions/work-item-embed/extension.tsx | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/packages/editor/src/core/extensions/callout/block.tsx b/packages/editor/src/core/extensions/callout/block.tsx index 7f4a8503de0..75b29c87057 100644 --- a/packages/editor/src/core/extensions/callout/block.tsx +++ b/packages/editor/src/core/extensions/callout/block.tsx @@ -1,5 +1,6 @@ import { NodeViewContent, NodeViewProps, NodeViewWrapper } from "@tiptap/react"; -import React, { useState } from "react"; +import React, { useState, useMemo } from "react"; +import { v4 as uuidv4 } from "uuid"; // constants import { COLORS_LIST } from "@/constants/common"; // local components @@ -22,11 +23,14 @@ export const CustomCalloutBlock: React.FC = (props) // states const [isEmojiPickerOpen, setIsEmojiPickerOpen] = useState(false); const [isColorPickerOpen, setIsColorPickerOpen] = useState(false); + // unique id + const uniqueId = useMemo(() => uuidv4(), []); // derived values const activeBackgroundColor = COLORS_LIST.find((c) => node.attrs["data-background"] === c.key)?.backgroundColor; return ( = ({ node }) => { const [copied, setCopied] = useState(false); + const uniqueId = useMemo(() => uuidv4(), []); + const copyToClipboard = async (e: React.MouseEvent) => { try { await navigator.clipboard.writeText(node.textContent); @@ -35,7 +38,7 @@ export const CodeBlockComponent: React.FC = ({ node }) }; return ( - +