Spaces:
Paused

dushyantsingh0 Claude Sonnet 4.6 commited on
Commit
7002df6
Β·
1 Parent(s): ce92d20

fix: remove duplicate loading bubble in NexusHub and NexusMasterAgent

Browse files

NexusContext immediately adds an empty assistant message on query start.
With content="", isActivelyStreaming was false, so both the empty bubble
from messages.map() and the ActivityPanel rendered simultaneously.

Skip rendering the empty assistant placeholder β€” ActivityPanel already
handles the pre-first-token loading phase.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

frontend/apps/customer/src/components/NexusMasterAgent.tsx CHANGED
@@ -432,8 +432,10 @@ export const NexusMasterAgent: React.FC = () => {
432
  </p>
433
  </div>
434
  )}
435
- {messages.map((m, i) => (
436
- <div key={i} style={{
 
 
437
  alignSelf: m.role === 'user' ? 'flex-end' : 'flex-start',
438
  maxWidth: '88%',
439
  padding: '16px 20px',
@@ -451,7 +453,8 @@ export const NexusMasterAgent: React.FC = () => {
451
  }}>
452
  {renderMessage(m, i, isActivelyStreaming && i === messages.length - 1)}
453
  </div>
454
- ))}
 
455
 
456
  {/* Live Activity Panel β€” shown while waiting for first tokens */}
457
  {loading && !isActivelyStreaming && (
 
432
  </p>
433
  </div>
434
  )}
435
+ {messages.map((m, i) => {
436
+ // Skip the empty assistant placeholder β€” ActivityPanel covers this loading phase
437
+ if (m.role === 'assistant' && !m.content && loading) return null;
438
+ return (<div key={i} style={{
439
  alignSelf: m.role === 'user' ? 'flex-end' : 'flex-start',
440
  maxWidth: '88%',
441
  padding: '16px 20px',
 
453
  }}>
454
  {renderMessage(m, i, isActivelyStreaming && i === messages.length - 1)}
455
  </div>
456
+ );
457
+ })}
458
 
459
  {/* Live Activity Panel β€” shown while waiting for first tokens */}
460
  {loading && !isActivelyStreaming && (
frontend/apps/internal/src/components/NexusMasterAgent.tsx CHANGED
@@ -280,6 +280,8 @@ export const NexusMasterAgent: React.FC<{ workspaceId?: string; workspaceName?:
280
  </div>
281
  )}
282
  {messages.map((m, i) => {
 
 
283
  const isAssistant = m.role === 'assistant';
284
  const isResolved = isAssistant && typeof m.content === 'string' && (m.content.includes('[ACTION_RESOLVED:approved]') || m.content.includes('[ACTION_RESOLVED:rejected]'));
285
  const hasAction = isAssistant && !isResolved && typeof m.content === 'string' && m.content.includes("[ACTION_REQUIRED]");
 
280
  </div>
281
  )}
282
  {messages.map((m, i) => {
283
+ // Skip the empty assistant placeholder β€” ActivityPanel covers this loading phase
284
+ if (m.role === 'assistant' && !m.content && loading) return null;
285
  const isAssistant = m.role === 'assistant';
286
  const isResolved = isAssistant && typeof m.content === 'string' && (m.content.includes('[ACTION_RESOLVED:approved]') || m.content.includes('[ACTION_RESOLVED:rejected]'));
287
  const hasAction = isAssistant && !isResolved && typeof m.content === 'string' && m.content.includes("[ACTION_REQUIRED]");
frontend/packages/shared/src/components/NexusHub.tsx CHANGED
@@ -1072,6 +1072,8 @@ export const NexusHub: React.FC<NexusHubProps> = ({ mode = "chat", workspaceId,
1072
  return (
1073
  <>
1074
  {messages.map((m: any, i: number) => {
 
 
1075
  const isStreamingThisMsg = isActivelyStreaming && i === messages.length - 1 && m.role === 'assistant';
1076
  return (
1077
  <div key={i} style={{
 
1072
  return (
1073
  <>
1074
  {messages.map((m: any, i: number) => {
1075
+ // Skip the empty assistant placeholder β€” ActivityPanel covers this loading phase
1076
+ if (m.role === 'assistant' && !m.content && loading) return null;
1077
  const isStreamingThisMsg = isActivelyStreaming && i === messages.length - 1 && m.role === 'assistant';
1078
  return (
1079
  <div key={i} style={{