Commit 5b8008ff by Liu

fix:常见问题鼠标悬浮效果&&关闭页签后按钮高亮逻辑

parent 1f2aae8c
......@@ -97,6 +97,19 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
// 根据 currentToolId 以及 sessionStorage 中的记录决定高亮逻辑
useEffect(() => {
// 场景:项目作为三方后台的子菜单时,外层可能清空了 sessionStorage,
// 但重新打开时仍使用带有 ?toolId=xxx 的旧 URL。
// 如果此时 Redux 和 sessionStorage 中都没有 currentToolId,则认为 URL 中的 toolId 已失效,
// 主动移除该查询参数并强制回到「通用模式」,避免错误高亮到上一次的工具模式。
if (!currentToolId && !sessionToolId && toolIdFromUrl) {
const newSearchParams = new URLSearchParams(searchParams)
newSearchParams.delete('toolId')
setSearchParams(newSearchParams, { replace: true })
setSelectedToolId(null)
setIsToolBtnActive(true)
return
}
// 只有当 sessionStorage 或 URL 中还能找到 toolId 时,才认为 Redux 中的 currentToolId 仍然有效
const hasPersistentToolSource = Boolean(sessionToolId || toolIdFromUrl)
......@@ -121,7 +134,7 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
setSelectedToolId(null)
setIsToolBtnActive(true)
}
}, [currentToolId, sessionToolId, toolIdFromUrl])
}, [currentToolId, sessionToolId, toolIdFromUrl, searchParams, setSearchParams])
// 监听 sessionStorage 中的 currentToolId(历史点击时写入)来辅助高亮逻辑
useEffect(() => {
......
......@@ -183,7 +183,13 @@ const QuestionListBase: React.FC<QuestionListProps & WithAuthProps> = ({
layout
className="w-full"
>
<Tooltip color="foreground" content={item} placement="top">
<Tooltip
color="foreground"
content={item}
placement="top"
// 鼠标移出后尽快关闭 Tooltip,避免停留过长
closeDelay={0}
>
<button
type="button"
onClick={() => handleClick(item)}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment