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(references): go to target message on reference click in one click (#4069)

gbirman53421a4c8754
diff --git a/js/app/packages/core/component/References.tsx b/js/app/packages/core/component/References.tsx
index c415cfd3f0..fa4bf0c61f 100644
--- a/js/app/packages/core/component/References.tsx
+++ b/js/app/packages/core/component/References.tsx
@@ -1,7 +1,7 @@
import { useGlobalBlockOrchestrator } from '@app/component/GlobalAppState';
import { SidePanel } from '@app/component/side-panel';
import { useSplitLayout } from '@app/component/split-layout/layout';
-import { getChannelParams } from '@block-channel/utils/link';
+import { navigateToChannelMessage } from '@block-channel/utils/link';
import type { BlockAlias, BlockName } from '@core/block';
import { toast } from '@core/component/Toast/Toast';
import { fileTypeToBlockName } from '@core/constant/allBlocks';
@@ -217,17 +217,6 @@ export function References(props: ReferenceProps) {
const { openWithSplit } = useSplitLayout();
const blockOrchestrator = useGlobalBlockOrchestrator();
- const goToMessageLocation = async (
- channelId: string,
- messageId: string,
- threadId?: string
- ) => {
- const blockHandle = await blockOrchestrator.getBlockHandle(channelId);
- await blockHandle?.goToLocationFromParams(
- getChannelParams(messageId, threadId)
- );
- };
-
const navigateToItem = ({
event,
blockId,
@@ -254,12 +243,15 @@ export function References(props: ReferenceProps) {
messageId: string;
threadId?: string;
}) => {
- navigateToItem({
- event,
- blockName: 'channel',
- blockId: channelId,
- });
- goToMessageLocation(channelId, messageId, threadId);
+ navigateToChannelMessage(
+ blockOrchestrator,
+ channelId,
+ messageId,
+ threadId,
+ {
+ preferNewSplit: event?.shiftKey !== true,
+ }
+ );
};
const navigateToGenericReference = (