diff --git a/src/components/room/RoomChatPanel.tsx b/src/components/room/RoomChatPanel.tsx index 3976829..da31b7f 100644 --- a/src/components/room/RoomChatPanel.tsx +++ b/src/components/room/RoomChatPanel.tsx @@ -29,6 +29,8 @@ import { RoomThreadPanel } from './RoomThreadPanel'; const MENTION_PATTERN = /@([^:@\s]*)(:([^\s]*))?$/; const MENTION_POPOVER_KEYS = ['Enter', 'Tab', 'ArrowUp', 'ArrowDown']; +/** Module-level ref shared between ChatInputArea (writes) and RoomChatPanel (reads) */ +const mentionConfirmRef = { current: (() => {}) as () => void }; export interface ChatInputAreaHandle { insertMention: (id: string, label: string, type: 'user' | 'ai') => void; @@ -283,8 +285,6 @@ export function RoomChatPanel({ room, isAdmin, onClose, onDelete }: RoomChatPane const messagesEndRef = useRef(null); const chatInputRef = useRef(null); - /** Shared ref: MentionPopover writes the confirm fn here; ChatInputArea reads and calls it */ - const mentionConfirmRef = useRef<() => void>(() => {}); const [replyingTo, setReplyingTo] = useState(null); const [editingMessage, setEditingMessage] = useState(null);