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): prevent empty-list flash when navigating to a message (#4176)
gbirman6aded6f265d1
diff --git a/js/app/packages/channel/Channel/Channel.tsx b/js/app/packages/channel/Channel/Channel.tsxindex c5634561e9..40decc430e 100644--- a/js/app/packages/channel/Channel/Channel.tsx+++ b/js/app/packages/channel/Channel/Channel.tsx@@ -349,25 +349,6 @@ export function Channel(props: ChannelProps) {targetMessageController.goToMessage(messageId, replyId);};- // Navigating to a message highlights it by selecting it. When the target- // isn't in the initially loaded page (e.g. opening an old message from- // search), that selection is auto-cleared by create-message-selection before- // the load-around resolves. Re-assert it once the target message has loaded.- // Tracked per-target so it applies only to the active navigation, not after- // the user selects something else.- let highlightedNavigationTarget: string | undefined;- createEffect(() => {- const targetId = targetMessageController.activeTargetMessageId();- if (!targetId || targetMessageController.activeTargetMessageReplyId()) {- highlightedNavigationTarget = undefined;- return;- }- if (highlightedNavigationTarget === targetId) return;- if (!messageIndex.keys.includes(targetId)) return;- highlightedNavigationTarget = targetId;- selectMessage(targetId);- });-const findBar = createChannelFindBar({channelId: () => props.channelId,goToMessage,diff --git a/js/app/packages/core/component/AI/component/tool/Search.tsx b/js/app/packages/core/component/AI/component/tool/Search.tsxindex 5e34de1108..c79386819b 100644--- a/js/app/packages/core/component/AI/component/tool/Search.tsx+++ b/js/app/packages/core/component/AI/component/tool/Search.tsx@@ -1,3 +1,4 @@+import { navigateToChannelMessage } from '@block-channel/utils/link';import { getEntityClickContent } from '@channel/Attachments/attachment-utils';import {type EntityData,@@ -82,15 +83,20 @@ const UnifiedSearchToolResponse = (props: {);const openEntity = async (entity: SearchEntity) => {- const content = getEntityClickContent(entity);- insertSplit(content);-- if (content.params) {- const blockHandle = await globalSplitManager()- ?.getOrchestrator()- .getBlockHandle(content.id);- await blockHandle?.goToLocationFromParams(content.params);+ if (entity.type === 'channel_message') {+ const orchestrator = globalSplitManager()?.getOrchestrator();+ if (orchestrator) {+ await navigateToChannelMessage(+ orchestrator,+ entity.channelId,+ entity.messageId,+ entity.threadId+ );+ return;+ }}++ insertSplit(getEntityClickContent(entity));};return (diff --git a/js/app/packages/queries/channel/channel-messages.ts b/js/app/packages/queries/channel/channel-messages.tsindex d9a0a4d25b..efedbf29a8 100644--- a/js/app/packages/queries/channel/channel-messages.ts+++ b/js/app/packages/queries/channel/channel-messages.ts@@ -84,6 +84,11 @@ export function channelMessagesQueryOptions();return normalizeChannelMessagesPageSenders(page);},+ placeholderData: (+ prev: ChannelMessagesData | undefined,+ prevQuery: { queryKey: ChannelMessagesQueryKey } | undefined+ ): ChannelMessagesData | undefined =>+ prevQuery?.queryKey.includes(channelId) ? prev : undefined,initialPageParam: null as ChannelMessagesPageParam | null,getNextPageParam: (lastPage: ChannelMessagesPage) =>lastPage.next_cursor