From a834564c0fd5b482d8ba89dd64a5eee6abf766c8 Mon Sep 17 00:00:00 2001 From: ZhenYi <434836402@qq.com> Date: Sat, 18 Apr 2026 11:09:17 +0800 Subject: [PATCH] fix(frontend): show mention popover when @ is typed Effect watches mentionState and toggles showMentionPopover accordingly. Without this, ms.setShowMentionPopover was never called in onChange, so the popover never appeared. --- src/components/room/RoomChatPanel.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/room/RoomChatPanel.tsx b/src/components/room/RoomChatPanel.tsx index e27cc18..fcfe7e4 100644 --- a/src/components/room/RoomChatPanel.tsx +++ b/src/components/room/RoomChatPanel.tsx @@ -161,6 +161,15 @@ const ChatInputArea = memo(function ChatInputArea({ }, 0); }, [draft, ms]); + // ─── Auto-show/hide popover when @ context appears ──────────────────── + useEffect(() => { + if (ms.mentionState && !ms.showMentionPopover) { + ms.setShowMentionPopover(true); + } else if (!ms.mentionState && ms.showMentionPopover) { + ms.setShowMentionPopover(false); + } + }, [ms.mentionState, ms.showMentionPopover, ms.setShowMentionPopover]); + // ─── mention-click handler (from message mentions) ───────────────────── useEffect(() => { const onMentionClick = (e: Event) => {