Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(channels): prevent consecutive message layout flash (#6778)
teo8ecac86e1274
diff --git a/apps/web/src/features/channel/Channel/message-grouping-meta.ts b/apps/web/src/features/channel/Channel/message-grouping-meta.tsindex a9a6e9d810..bef3ba3c7c 100644--- a/apps/web/src/features/channel/Channel/message-grouping-meta.ts+++ b/apps/web/src/features/channel/Channel/message-grouping-meta.ts@@ -26,7 +26,12 @@ export function shouldGroupWithPreviousMessage(// Agent messages share the Macro bot's sender_id but carry the triggering// user in `sender.triggered_by`; messages prompted by different users must// not merge under a single "from" pill.- if (current.sender?.triggered_by !== previous.sender?.triggered_by) {+ // Optimistic sends omit attribution; server messages can return null.+ // Both represent the same absence and must group before acknowledgement.+ if (+ (current.sender?.triggered_by ?? null) !==+ (previous.sender?.triggered_by ?? null)+ ) {return false;}if (isDeleted(current) || isDeleted(previous)) return false;diff --git a/apps/web/src/features/channel/Channel/tests/message-grouping-meta.test.ts b/apps/web/src/features/channel/Channel/tests/message-grouping-meta.test.tsindex 8e6b54b550..b344c7b980 100644--- a/apps/web/src/features/channel/Channel/tests/message-grouping-meta.test.ts+++ b/apps/web/src/features/channel/Channel/tests/message-grouping-meta.test.ts@@ -45,6 +45,58 @@ describe('message grouping meta', () => {expect(shouldGroupWithPreviousMessage(current, previous)).toBe(true);});+ it.each([+ [null, undefined],+ [undefined, null],+ ] as const)(+ 'groups same-author messages when absent attribution is %s then %s',+ (previousTriggeredBy, currentTriggeredBy) => {+ const previous = createMessage('m1', '2026-02-20T09:00:00.000Z');+ const current = createMessage('m2', '2026-02-20T09:01:00.000Z');+ previous.sender = {+ ...senderFromStorageId(previous.sender_id),+ triggered_by: previousTriggeredBy,+ };+ current.sender = {+ ...senderFromStorageId(current.sender_id),+ triggered_by: currentTriggeredBy,+ };++ // Optimistic sends omit attribution; persisted messages can return null.+ expect(shouldGroupWithPreviousMessage(current, previous)).toBe(true);+ current.sender.triggered_by = null;+ expect(shouldGroupWithPreviousMessage(current, previous)).toBe(true);+ }+ );++ it.each([+ ['user-1', 'user-1', true],+ ['user-1', 'user-2', false],+ ['user-1', null, false],+ [undefined, 'user-1', false],+ ] as const)(+ 'groups bot messages attributed to %s then %s: %s',+ (previousTriggeredBy, currentTriggeredBy, expected) => {+ const senderId = 'bot|00000000-0000-0000-0000-000000000001';+ const previous = createMessage(+ 'm1',+ '2026-02-20T09:00:00.000Z',+ senderId+ );+ const current = createMessage('m2', '2026-02-20T09:01:00.000Z', senderId);+ previous.sender = {+ ...senderFromStorageId(senderId),+ triggered_by: previousTriggeredBy,+ };+ current.sender = {+ ...senderFromStorageId(senderId),+ triggered_by: currentTriggeredBy,+ };++ expect(shouldGroupWithPreviousMessage(current, previous)).toBe(expected);+ }+ );+it('does not group when author changes', () => {const previous = createMessage('m1', '2026-02-20T09:00:00.000Z');const current = createMessage('m2', '2026-02-20T09:01:00.000Z', 'user-2');diff --git a/docs/AGENT_GUIDE/channels.md b/docs/AGENT_GUIDE/channels.mdindex 4874574e8f..5ba4b914b2 100644--- a/docs/AGENT_GUIDE/channels.md+++ b/docs/AGENT_GUIDE/channels.md@@ -419,6 +419,12 @@ useful as a guaranteed-existing channel in tests.Locally sent channel messages and thread replies enter with a brief upward slideand fade, without bubble scaling. Opening history or remounting a row does notreplay the effect. Reduced-motion preferences disable it.+Consecutive messages from the same sender should enter in their grouped layout,+without briefly showing an avatar/header and collapsing after acknowledgement.+Check this with a delayed send response in both the channel and a thread, sending+each follow-up within five minutes of a confirmed message with no replies.+Messages from different senders, including bot messages triggered by different+users, should retain separate headers.For mobile send regressions, keep the software keyboard open and send severalshort and multiline messages consecutively. The keyboard should remain open,