Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

💄 style(conversation): let ChatList hide the background-run loading hint (#19906)

YuTengjingaf83723bf562
diff --git a/src/features/Conversation/ChatList/index.tsx b/src/features/Conversation/ChatList/index.tsx
index c59f71788a7..6ff6f6764e6 100644
--- a/src/features/Conversation/ChatList/index.tsx
+++ b/src/features/Conversation/ChatList/index.tsx
@@ -20,6 +20,7 @@ import WideScreenContainer from '../../WideScreenContainer';
import SkeletonList from '../components/SkeletonList';
import MessageItem from '../Messages';
import type { WorkflowExpandLevelDefault } from '../Messages/AssistantGroup/components/WorkflowCollapse';
+import { BackgroundRunHintContext } from '../Messages/Contexts/BackgroundRunHintContext';
import { MessageActionProvider } from '../Messages/Contexts/MessageActionProvider';
import { dataSelectors, inputSelectors, useConversationStore } from '../store';
import AgentSignalReceiptList from './components/AgentSignalReceiptList';
@@ -76,6 +77,11 @@ export interface ChatListProps {
* It scrolls with messages and does not participate in conversation state.
*/
headerSlot?: ReactNode;
+ /**
+ * Hide the "task keeps running on the server, you can leave" loading copy and
+ * show the plain dot loader instead (e.g. on external visitor surfaces).
+ */
+ hideBackgroundRunHint?: boolean;
/**
* Custom item renderer. If not provided, uses default ChatItem.
*/
@@ -103,6 +109,7 @@ const ChatList = memo<ChatListProps>(
filterItem,
footerSlot,
headerSlot,
+ hideBackgroundRunHint,
welcome,
itemContent,
messageDeepLink,
@@ -289,13 +296,15 @@ const ChatList = memo<ChatListProps>(
</WideScreenContainer>
) : (
<MessageActionProvider withSingletonActionsBar={!disableActionsBar}>
- <VirtualizedList
- dataSource={rowIds}
- footerSlot={footerSlot}
- headerSlot={headerSlot}
- itemContent={itemContent ?? defaultItemContent}
- messageDeepLink={resolvedMessageDeepLink}
- />
+ <BackgroundRunHintContext value={!hideBackgroundRunHint}>
+ <VirtualizedList
+ dataSource={rowIds}
+ footerSlot={footerSlot}
+ headerSlot={headerSlot}
+ itemContent={itemContent ?? defaultItemContent}
+ messageDeepLink={resolvedMessageDeepLink}
+ />
+ </BackgroundRunHintContext>
</MessageActionProvider>
);
diff --git a/src/features/Conversation/Messages/Contexts/BackgroundRunHintContext.ts b/src/features/Conversation/Messages/Contexts/BackgroundRunHintContext.ts
new file mode 100644
index 00000000000..c6b837c1bab
--- /dev/null
+++ b/src/features/Conversation/Messages/Contexts/BackgroundRunHintContext.ts
@@ -0,0 +1,10 @@
+import { createContext, useContext } from 'react';
+
+/**
+ * Whether the loading indicator may tell the user a server-side run keeps going
+ * after they leave the page. Surfaces where that reassurance means nothing to
+ * the reader (e.g. an external visitor view) turn it off via `ChatList`.
+ */
+export const BackgroundRunHintContext = createContext(true);
+
+export const useShowBackgroundRunHint = () => useContext(BackgroundRunHintContext);
diff --git a/src/features/Conversation/Messages/components/ContentLoading.tsx b/src/features/Conversation/Messages/components/ContentLoading.tsx
index 6b1c0fb88b3..25470f8a297 100644
--- a/src/features/Conversation/Messages/components/ContentLoading.tsx
+++ b/src/features/Conversation/Messages/components/ContentLoading.tsx
@@ -11,6 +11,7 @@ import { type OperationType, type StreamRetryMetadata } from '@/store/chat/slice
import { elapsedTimeStyles, shinyTextStyles } from '@/styles/loading';
import { resolveOperationActivity } from '../../utils/operationActivity';
+import { useShowBackgroundRunHint } from '../Contexts/BackgroundRunHintContext';
const ELAPSED_TIME_THRESHOLD = 2100; // Show elapsed time after 2 seconds
@@ -41,6 +42,7 @@ interface ContentLoadingProps {
const ContentLoading = memo<ContentLoadingProps>(({ id, startTime: startTimeOverride }) => {
const { t } = useTranslation('chat');
const runningOp = useChatStore(operationSelectors.getDeepestRunningOperationByMessage(id));
+ const showBackgroundRunHint = useShowBackgroundRunHint();
const startTime =
startTimeOverride !== undefined && Number.isFinite(startTimeOverride)
@@ -116,6 +118,9 @@ const ContentLoading = memo<ContentLoadingProps>(({ id, startTime: startTimeOver
return t('operation.execHeterogeneousAgent', { name: getHeterogeneousAgentName() });
}
+ // Surfaces that turned the hint off fall back to the plain dot loader.
+ if (operationType === 'execServerAgentRuntime' && !showBackgroundRunHint) return undefined;
+
if (DEDICATED_OPERATION_LABELS.has(operationType)) {
return t(`operation.${operationType}` as any) as string;
}