From 8c3c52b00856f10d7b33eebf6a93d3ac1da25454 Mon Sep 17 00:00:00 2001 From: 02356abc <198679067+02356abc@users.noreply.github.com> Date: Mon, 25 May 2026 12:32:04 +0800 Subject: [PATCH] fix(dashboard): stop ChatPage from clearing all pages' header action buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When embedded chat is enabled, ChatPage renders persistently outside but is initially hidden during the plugin-loading window (~2-4s). Once plugins finish loading, ChatPage mounts for the first time. Its header-slot effect had early-return branches for !isActive and !narrow that actively called setEnd(null). Because the user was on /cron, /models, /sessions, or any non-chat page, this wiped the action buttons that the current page had already placed in the header. Affected pages include: - Cron page — CREATE button disappears - Models page — 7D/30D/90D filter buttons disappear - Sessions page — search box disappears The fix collapses the two early-return branches into one and removes the setEnd(null) calls. Now ChatPage only sets end when it actually owns the slot (isActive && narrow), and lets the normal cleanup handle unmounting. PageHeaderProvider already clears all slots on pathname change via useLayoutEffect, so ChatPage's active clearing was redundant and harmful. Fixes #31862 Co-Authored-By: Claude Sonnet 4.6 --- web/src/pages/ChatPage.tsx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/web/src/pages/ChatPage.tsx b/web/src/pages/ChatPage.tsx index f7432d267cc8b..58806c2733dfb 100644 --- a/web/src/pages/ChatPage.tsx +++ b/web/src/pages/ChatPage.tsx @@ -410,14 +410,7 @@ export default function ChatPage({ isActive = true }: { isActive?: boolean }) { useEffect(() => { // When hidden (non-chat tab) we must not register the header button — // another page owns the header's end slot at that point. - if (!isActive) { - setEnd(null); - return; - } - if (!narrow) { - setEnd(null); - return; - } + if (!isActive || !narrow) return; setEnd(