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(inbox): latest channel message from current user not shown after sending message (#4825)
dev-rbd3fd7a3d7c3b
diff --git a/apps/web/src/lib/queries/channel/message.ts b/apps/web/src/lib/queries/channel/message.tsindex 839cface8e..a7f80dc66f 100644--- a/apps/web/src/lib/queries/channel/message.ts+++ b/apps/web/src/lib/queries/channel/message.ts@@ -3,6 +3,10 @@ import type { OptimisticPostMessageAttachment } from '@channel/Input/message-payimport { toast } from '@core/component/Toast/Toast';import type { DateValue } from '@core/util/date';import { throwOnErr } from '@core/util/result';+import {+ invalidateSoupEntity,+ refetchSoupEntity,+} from '@queries/soup/normalized-cache';import { type MutationCallbacks, withCallbacks } from '@queries/utils';import {type ApiChannelMessage,@@ -457,16 +461,26 @@ export function useSendMessageMutation(});},onSuccess(data, variables) {+ const threadId = variables.message.thread_id ?? undefined;replaceOptimisticMessage({channelId: variables.channelID,optimisticId: variables.optimisticId,realId: data.id,- threadId: variables.message.thread_id ?? undefined,+ threadId,});++ // The sender does not receive the notification that normally refreshes+ // this soup entity. Refresh root messages here so the channel moves to+ // its updated position in soup lists.+ if (threadId === undefined) {+ refetchSoupEntity(variables.channelID, 'channel');+ invalidateSoupEntity(variables.channelID);+ }+analytics.track('channel_message_sent', {contentLength: variables.message.content?.length ?? 0,attachmentsLength: variables.message.attachments.length,- isThreadReply: variables.message.thread_id !== undefined,+ isThreadReply: threadId !== undefined,});},onError(error, vars, context) {