Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(web): stop mention pills flashing during AI response streaming (#6533)

Jacob Beckerman633c3afcd603
diff --git a/apps/web/src/features/block-agent/component/parts/TextPart.tsx b/apps/web/src/features/block-agent/component/parts/TextPart.tsx
index 000bdb9a58..586cb2254e 100644
--- a/apps/web/src/features/block-agent/component/parts/TextPart.tsx
+++ b/apps/web/src/features/block-agent/component/parts/TextPart.tsx
@@ -16,6 +16,8 @@ export function TextPart(props: { text: string; inFlight?: boolean }) {
markdown={markdown()}
theme={channelTheme}
target="internal"
+ // Keep resolved mentions visible across stream reparses and completion.
+ lazy={false}
/>
</div>
);
diff --git a/apps/web/src/lib/core/component/AI/component/debug/StaticMarkdownStream.tsx b/apps/web/src/lib/core/component/AI/component/debug/StaticMarkdownStream.tsx
index b4a3b3f167..75895ad3b7 100644
--- a/apps/web/src/lib/core/component/AI/component/debug/StaticMarkdownStream.tsx
+++ b/apps/web/src/lib/core/component/AI/component/debug/StaticMarkdownStream.tsx
@@ -2,10 +2,7 @@ import {
type BufferedChatMessageStream,
bufferedStream,
} from '@core/component/AI/util/stream';
-import {
- StaticMarkdown,
- StaticMarkdownContext,
-} from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
+import { StaticMarkdownContext } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
import { aiChatTheme } from '@core/component/LexicalMarkdown/theme';
import PlayIcon from '@phosphor-icons/core/regular/play.svg?component-solid';
import StopIcon from '@phosphor-icons/core/regular/stop.svg?component-solid';
@@ -24,6 +21,7 @@ import {
onCleanup,
Show,
} from 'solid-js';
+import { ChatMessageMarkdown } from '../message/ChatMessageMarkdown';
const SAMPLE_TEXT = `Here is a streamed Macro XML sample:
@@ -324,7 +322,10 @@ export default function StaticMarkdownStreamDebug() {
}
>
<StaticMarkdownContext theme={aiChatTheme}>
- <StaticMarkdown markdown={renderedText()} target="internal" />
+ <ChatMessageMarkdown
+ text={renderedText()}
+ generating={isStreaming}
+ />
</StaticMarkdownContext>
</Show>
</div>
diff --git a/apps/web/src/lib/core/component/AI/component/message/ChatMessageMarkdown.tsx b/apps/web/src/lib/core/component/AI/component/message/ChatMessageMarkdown.tsx
index 3de2f0e261..3365fa2ae5 100644
--- a/apps/web/src/lib/core/component/AI/component/message/ChatMessageMarkdown.tsx
+++ b/apps/web/src/lib/core/component/AI/component/message/ChatMessageMarkdown.tsx
@@ -46,6 +46,9 @@ export function ChatMessageMarkdown(props: {
setStateRef={props.setStateRef}
stateRefKey={props.stateRefKey}
target="internal"
+ // Streaming reparses the tree; viewport gating would reset resolved
+ // mentions to placeholders on every update, including the final one.
+ lazy={false}
/>
);
}
diff --git a/docs/AGENT_GUIDE/ai-chat.md b/docs/AGENT_GUIDE/ai-chat.md
index 970f30e754..b3ec6e1395 100644
--- a/docs/AGENT_GUIDE/ai-chat.md
+++ b/docs/AGENT_GUIDE/ai-chat.md
@@ -13,6 +13,11 @@
## Start a standalone chat
+While an answer streams, resolved mention pills should keep their names and
+icons instead of flashing back to loading placeholders. Check an answer with
+multiple mentions while more text arrives and when generation finishes, in both
+chat and agent sessions. A newly encountered mention may load once.
+
On mobile, every screen has a single-line AI composer directly above the bottom
dock. A labeled glass button beside it opens the current view's create action:
**+ Email**, **+ Task**, **+ Document**, **+ Message**, or **+ Event**. Home’s