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.
This commit is contained in:
ZhenYi 2026-04-18 11:09:17 +08:00
parent 8d3ecca0bc
commit a834564c0f

View File

@ -161,6 +161,15 @@ const ChatInputArea = memo(function ChatInputArea({
}, 0); }, 0);
}, [draft, ms]); }, [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) ───────────────────── // ─── mention-click handler (from message mentions) ─────────────────────
useEffect(() => { useEffect(() => {
const onMentionClick = (e: Event) => { const onMentionClick = (e: Event) => {