From 24766b4a32400cfd5ce46734c13d2dcf63d401e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E8=89=B3=E5=85=B5?= Date: Thu, 3 Sep 2026 09:43:25 +0800 Subject: [PATCH] refactor: use renderable guard for suffix --- package.json | 2 +- src/Mentions.tsx | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 7157d28..5292579 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@rc-component/input": "~1.3.1", "@rc-component/menu": "~1.6.0", "@rc-component/trigger": "^3.0.0", - "@rc-component/util": "^1.11.1", + "@rc-component/util": "^1.13.0", "clsx": "^2.1.1" }, "devDependencies": { diff --git a/src/Mentions.tsx b/src/Mentions.tsx index 79b415b..1f3ae35 100644 --- a/src/Mentions.tsx +++ b/src/Mentions.tsx @@ -7,6 +7,7 @@ import type { TextAreaRef, } from '@rc-component/input'; import { + isReactRenderable, KeyCode, toArray, useControlledState, @@ -662,7 +663,8 @@ const Mentions = forwardRef( }, ref, ) => { - const hasSuffix = !!(suffix || allowClear); + const hasSuffix = isReactRenderable(suffix) || Boolean(allowClear); + const suffixNode = isReactRenderable(suffix) ? <>{suffix} : suffix; // =============================== Ref ================================ const holderRef = useRef(null); @@ -693,7 +695,7 @@ const Mentions = forwardRef( return (