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(channel): duplicate thread messages and sending messages not updating list (#672)
dev-rb86a1a91d49ae
diff --git a/js/app/packages/block-channel/component/Channel.tsx b/js/app/packages/block-channel/component/Channel.tsxindex a72d5bf2cf..7e2ba49a62 100644--- a/js/app/packages/block-channel/component/Channel.tsx+++ b/js/app/packages/block-channel/component/Channel.tsx@@ -11,7 +11,10 @@ import {isDraggingOverChannelSignal,isValidChannelDragSignal,} from '@block-channel/signal/attachment';-import { refetchChannelData } from '@block-channel/signal/channel';+import {+ channelStore,+ refetchChannelData,+} from '@block-channel/signal/channel';import { activeThreadIdSignal } from '@block-channel/signal/threads';import { handleFileUpload } from '@block-channel/utils/inputAttachments';import { withAnalytics } from '@coparse/analytics';@@ -82,6 +85,7 @@ export function Channel(props: {data: Required<ChannelData>;target?: TargetMessageInfo;}) {+ const channelStoreData = channelStore.get;const channel = useChannelQuery(() => props.data.channel.id);const [_activeThreadId, setActiveThreadId] = activeThreadIdSignal;@@ -354,7 +358,7 @@ export function Channel(props: {/><MessageListchannelId={channelId}- messages={channel.data?.messages ?? []}+ messages={channelStoreData.messages}focusedMessageId={focusedMessageId}setFocusedMessageId={setFocusedMessageId}targetMessage={targetMessage}diff --git a/js/app/packages/block-channel/signal/channel.ts b/js/app/packages/block-channel/signal/channel.tsindex 1e3d492c2f..9037dfd73e 100644--- a/js/app/packages/block-channel/signal/channel.ts+++ b/js/app/packages/block-channel/signal/channel.ts@@ -8,6 +8,7 @@ import {isStaticAttachmentType,} from '@core/store/cacheChannelInput';import { isErr } from '@core/util/maybeResult';+import { invalidateChannelWithID } from '@queries/channel/channel';import { commsServiceClient } from '@service-comms/client';import type { Attachment } from '@service-comms/generated/models/attachment';import type { Channel } from '@service-comms/generated/models/channel';@@ -269,6 +270,7 @@ export async function sendMessage({});channelsContext.refetchChannels();+ invalidateChannelWithID(channelId);if (isErr(result)) {console.error('failed to send message', result[0]);diff --git a/js/app/packages/queries/channel/channel.ts b/js/app/packages/queries/channel/channel.tsindex d135d71998..1b22f88a02 100644--- a/js/app/packages/queries/channel/channel.ts+++ b/js/app/packages/queries/channel/channel.ts@@ -105,3 +105,9 @@ export function optimisticUpdateChannelName(});}++export function invalidateChannelWithID(channelID: string) {+ queryClient.invalidateQueries({+ queryKey: channelKeys.withID(channelID).queryKey,+ });+}