From c370e2a5a525cb340ce53991a8aa1b2bd389cf32 Mon Sep 17 00:00:00 2001 From: chengyongru <2755839590@qq.com> Date: Thu, 24 Sep 2026 22:05:31 +0800 Subject: [PATCH] fix(webui): refine mobile actions and avoid duplicate settings loads --- webui/src/App.tsx | 7 ++++++ webui/src/components/MessageBubble.tsx | 5 ++-- .../src/components/thread/ThreadMessages.tsx | 6 ++--- webui/src/components/thread/ThreadShell.tsx | 6 +++-- .../components/thread/WorkspaceControls.tsx | 11 ++++++++- webui/src/tests/thread-shell.test.tsx | 23 +++++++++++++++++++ 6 files changed, 50 insertions(+), 8 deletions(-) diff --git a/webui/src/App.tsx b/webui/src/App.tsx index 4a0d69224..c7fe0ff52 100644 --- a/webui/src/App.tsx +++ b/webui/src/App.tsx @@ -1175,6 +1175,7 @@ function Shell({ const skills = useSkills(getToken); const pageVisible = usePageVisibility(); const [settingsSnapshot, setSettingsSnapshot] = useState(null); + const [settingsLoading, setSettingsLoading] = useState(true); const settingsRefreshGenerationRef = useRef(0); const [pendingAutomationMessage, setPendingAutomationMessage] = useState<{ id: string; @@ -1298,6 +1299,7 @@ function Shell({ useEffect(() => { let cancelled = false; const requestGeneration = settingsRefreshGenerationRef.current; + setSettingsLoading(true); fetchSettings(getToken()) .then((payload) => { if (!cancelled && requestGeneration === settingsRefreshGenerationRef.current) { @@ -1308,6 +1310,9 @@ function Shell({ if (!cancelled && requestGeneration === settingsRefreshGenerationRef.current) { setSettingsSnapshot(null); } + }) + .finally(() => { + if (!cancelled) setSettingsLoading(false); }); return () => { cancelled = true; @@ -2906,6 +2911,7 @@ function Shell({ workspaceError={workspaceError} onWorkspaceScopeChange={applyWorkspaceScope} settingsSnapshot={settingsSnapshot} + settingsLoading={settingsLoading} onOpenModelSettings={onOpenModelSettings} skills={skills} /> @@ -2968,6 +2974,7 @@ function Shell({ client.setWorkspaceScope(paneSession.chatId, next); }} settingsSnapshot={settingsSnapshot} + settingsLoading={settingsLoading} onOpenModelSettings={onOpenModelSettings} skills={skills} /> diff --git a/webui/src/components/MessageBubble.tsx b/webui/src/components/MessageBubble.tsx index b47c2dbcf..28b5cef74 100644 --- a/webui/src/components/MessageBubble.tsx +++ b/webui/src/components/MessageBubble.tsx @@ -249,7 +249,7 @@ export function MessageBlockMenuActions({ "text-start text-[11px] leading-4", "text-muted-foreground transition-colors hover:text-foreground", "focus-visible:outline-none", - sheet && "w-full rounded-control text-sm hover:bg-muted/70", + sheet && "w-full gap-2 rounded-control px-2 text-sm hover:bg-muted/70", )} > @@ -281,7 +282,7 @@ export function MessageBlockMenuActions({ {timestampLabel || automationSourceLabel ? (
{timestampLabel ? (